我已经设法根据有效的付款方式(从现有的应答代码中获取)获得了一些代码,该代码是:
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );
function add_order_email_instructions( $order, $sent_to_admin ) {
if ( ! $sent_to_admin ) {
if ( 'cod' == $order->payment_method ){
// cash on delivery method
echo '<p><strong>Please note: </strong>Your repair is currently pending acceptance from your local technician. A member of our team will contact you shortly.</p>';
}
elseif( $product_category == 'unlocking'){
// unlocking email
echo '<p>Your device should be unlocked within 48 hours, if your device requires an unlock code we will be in touch.</p>';
}
else {
// other methods (ie credit card)
echo '<p><strong>Instructions:</strong> Please ensure your device is packaged securely and send it to the following address:</p><br><br><p><strong>Please note; if using our Unlocking service, you do NOT need to send us your device.</strong></p>';
}
}
}
我假设我对$product_category
的使用是不正确的,需要一些参考。我尝试使用“ WooCommerce email based on shipping zone” 应答代码来添加送货区域,但是对于我来说似乎不起作用。
任何建议将不胜感激。
答案 0 :(得分:0)
要检查订单中的特定产品类别,您将需要遍历订单中的项目,并检查每个项目中所需的类别。这是修改后的功能,然后是第二个功能,它负责检查是否存在特定的产品类别。
x
-
1234567.67890,45678.901234
7890123.67890,67890.801234
5678902.67834,90123.101234
3214567.234721,12456.890123
4532890.783421,453212.23412