Every product in my database has an "pa_producator" attribute, and i want the following thing: When pa_producator is equal to "Bosch", apply an 10% discount on that product only, not on the whole cart. Is this possible? Until now i have only the following code:
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;
}
}
How can i apply discount for those products?