我需要这样做,以便订购电子邮件的数量仅对特定产品显示为两倍。我修改了email-order-items.php如下(不起作用):
添加到第28行:$product_id = $product->get_product_id();
在第79行添加:
if( $product_id == 6960) {
$qty_display = '<del>' . esc_html( $qty ) . '</del> <ins>' . esc_html( $qty * 2 ) . '</ins>';
}
https://github.com/woocommerce/woocommerce/blob/master/templates/emails/email-order-items.php
答案 0 :(得分:0)
您可以为此使用以下功能, 如果您不知道如何或在何处添加此代码,请查看以下链接
function filter_woocommerce_email_order_item_quantity( $qty_display, $item ) {
$product = $item->get_product();
$product_id = $product->get_id();
if ( $product_id == 6960 ) {
$qty_display = $qty_display * 2;
}
return $qty_display;
};
add_filter( 'woocommerce_email_order_item_quantity', 'filter_woocommerce_email_order_item_quantity', 10, 2 );