【发布时间】:2019-09-26 13:17:59
【问题描述】:
我已经设法获得了一些基于有效付款方式的代码(取自现有答案代码),即:
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" 回答代码来添加运输区域,但它似乎不适用于我的情况。
任何建议将不胜感激。
【问题讨论】:
-
我想你忘了写超链接以供参考。
-
如果您不对其进行更改,请不要在您的问题中添加来自 Stack Overflow 的现有代码...始终添加您在问题中使用的代码 sn-ps 链接(即使您做了一些改动)。也试着澄清你的问题编辑它......
标签: php wordpress function email woocommerce