简体   繁体   English

将产品简短描述添加到Woocommerce电子邮件通知

[英]Add product short description to Woocommerce Email notifications

Hello me to slove this problem. 你好我要解决这个问题。 I want to add short description of products woocommerce to my email comming because my customer having to much attibute thanks guide me where to add code? 我想在我的电子邮件中添加产品woocommerce的简短描述,因为我的客户非常感谢,引导我在哪里添加代码?

The following will add short description to email notifications: 以下内容将为电子邮件通知添加简短描述:

add_action( 'woocommerce_order_item_meta_end', 'product_description_in_new_email_notification', 10, 4 );
function product_description_in_new_email_notification( $item_id, $item, $order = null, $plain_text = false ){
    $product = $item->get_product();

    // Handling product variations
    if( $product->is_type('variation') )
        $product = wc_get_product( $item->get_product_id() );

    // Display the product short description
    echo '<div class="product-description" style="margin:10px 0 0;"><p>' . $product->get_short_description() . '</p></div>';
}

Code goes in function.php file of your active child theme (or active theme). 代码进入您的活动子主题(或活动主题)的function.php文件中。 Tested and works. 经过测试和工作。

在此处输入图片说明


Related: Add the product description to WooCommerce email notifications 相关: 将产品描述添加到WooCommerce电子邮件通知中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM