【发布时间】:2019-04-09 17:16:14
【问题描述】:
在 WooCommerce 结帐字段shipping_address_2,我已经建立了一个自定义折扣券。我需要的是在特定的电子邮件通知中获取此订单字段值。
这是我的代码尝试:
add_action( 'woocommerce_email_before_order_table', 'add_content_to_specific_email', 20, 4 );
function add_content_to_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == 'customer_processing_order' ) {
echo '<h2 class="email-upsell-title">Get 20% off</h2><p class="email-upsell-p">Thank you for making this purchase! Come back and use the code "<strong> get_post_meta( $order_id, '_shipping_address_2', true ) </strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>';
}
}
它不起作用。我想将此字段值转换为<strong> html标签之间的字符串。
欢迎您的帮助。
【问题讨论】:
标签: php wordpress woocommerce orders email-notifications