admin管理员组文章数量:1130349
I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.
I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.
Share Improve this question asked Jun 15, 2017 at 10:14 Pankaj ThakurPankaj Thakur 11 silver badge2 bronze badges2 Answers
Reset to default 2Firstly extend WC_Email class to define the email header, subject, email template for content
secondly, add custom email class to the default WooCommerce email classes using woocommerce_email_classes filter, with trigger that calls terms
if ( has_term( 'Your Cat', 'product_cat', $item['product_id'] ) )
lastly, Create an email template to be used to generate email content for your custom email.
this answer to this question involves a lot of code, far too much for SO so you may want to do some reading like.
https://cloudredux/adding-sending-custom-woocommerce-email/
Whatever plugin you're using for ecommerce, there should be an email hook available to customize the emails.
For example, WooCommerce provides 9 different hooks in its "new order" email. Here's a visual reference.
Add a function that runs on the desired hook, and you can add conditional content. You'll have to find a way to identify "any product from a particular category" - pull order details, loop through the products, and if any of them is from that category, trigger your conditional content.
Further related reading: https://tommcfarlin/customizing-woocommerce-emails-hooks/
I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.
I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.
Share Improve this question asked Jun 15, 2017 at 10:14 Pankaj ThakurPankaj Thakur 11 silver badge2 bronze badges2 Answers
Reset to default 2Firstly extend WC_Email class to define the email header, subject, email template for content
secondly, add custom email class to the default WooCommerce email classes using woocommerce_email_classes filter, with trigger that calls terms
if ( has_term( 'Your Cat', 'product_cat', $item['product_id'] ) )
lastly, Create an email template to be used to generate email content for your custom email.
this answer to this question involves a lot of code, far too much for SO so you may want to do some reading like.
https://cloudredux/adding-sending-custom-woocommerce-email/
Whatever plugin you're using for ecommerce, there should be an email hook available to customize the emails.
For example, WooCommerce provides 9 different hooks in its "new order" email. Here's a visual reference.
Add a function that runs on the desired hook, and you can add conditional content. You'll have to find a way to identify "any product from a particular category" - pull order details, loop through the products, and if any of them is from that category, trigger your conditional content.
Further related reading: https://tommcfarlin/customizing-woocommerce-emails-hooks/
本文标签: woocommerce offtopicCustom email template for a specific product category
版权声明:本文标题:woocommerce offtopic - Custom email template for a specific product category 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749063363a2310438.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论