所以就有了这个函数:
function rpress_get_service_types() {
$service_types = array(
'delivery' => __( 'Delivery', 'restropress' ),
'pickup' => __( 'Pickup', 'restropress' )
);
return apply_filters( 'rpress_service_type', $service_types );
}
我想从中获得价值。比方说,是'delivery'还是'pickup'?
然后,我需要知道整个代码引用的产品是否设置为 or 'pickup'-'delivery'每个产品仅分配给这两个值之一。
因此,在我尝试验证它是否与这两个值之一匹配之前,我想我应该将其打印在我发送给自己的测试电子邮件中......以查看它是否有效。
下面的代码返回The order #2262 is ready for delivery!Arraytest我作为测试收到的电子邮件的值:
function send_customer_purchase_notification_ready( $payment_id, $new_status ) {
$pickup_or_delivery = rpress_get_service_types( $service_types );
$order_status = rpress_get_option( $new_status );
$check_notification_enabled = isset( $order_status['enable_notification'] ) ? true : false;
if ( !empty( $payment_id ) && $check_notification_enabled && $new_status !== 'pending' && $new_status == 'ready' ) {
$message = 'The order #' .$payment_id. ' is ready for delivery!' .$pickup_or_delivery. 'test';
$to = 'email@gmail.com';
$subject = "READY FOR PICKUP";
$headers = '';
//Here put your Validation and send mail
$sent = wp_mail($to, $subject, strip_tags($message), $headers);
}
}
add_action( 'rpress_update_order_status', 'send_customer_purchase_notification_ready' , 10, 2 );
正如你所看到的,我将变量放在里面$message = 'The order #' .$payment_id. ' is ready for delivery!' .$pickup_or_delivery. 'test';
总结一下:此代码显示单词Array。
我已经尝试移动东西好几个小时了,但我感觉自己在撞墙。有任何想法吗?
偶然的你
Helenr