0
我的数据库中的每个产品都有一个“pa_producator”属性,我想要以下东西: 当pa_producator等于“Bosch”时,仅对该产品应用10%的折扣,而不是整车。这可能吗?到目前为止,我只有以下代码:Woocommerce折扣如果有某些属性
add_action('woocommerce_before_cart_table', 'discount_producer');
function discount_producer() {
global $woocommerce;
$test = $woocommerce->cart->get_cart();
foreach($test as $product) {
$test = get_the_terms($product['product_id'], 'pa_producator');
$producator = $test[0]->name;
}
}
我该如何为这些产品申请折扣?