Adding a custom woocommerce email based on the product attribute

末鹿安然 提交于 2019-11-30 15:45:20

Instead of using get_attribute() function you should try to use get_attributes() this way:

//set 2) from the product_id get the product attribute
$product = new WC_Product( $product_id );  // create an object of WC_Product class

$patt = $product->get_attributes();  // call get_attributes method

//step 3) condition valid to send the email (if the attributes is csr-dates)
if ( array_key_exists('pa_csr-dates', $patt) ) 
{

Try it, this should work…

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!