I'm trying to update the tax class based on the category being set. I need to use the Reduced Rate for everything in my category "Books". The category ID is 133, and I'm currently using this filter, but it's not working. What am I missing here?
add_action( 'woocommerce_new_product', 'change_tax_for_books' );
function change_tax_for_books( $id ) {
if( has_term( 133, 'product_cat', $id ) ) {
$product = wc_get_product( $id );
$product->set_tax_class( 'Reduced Rate' );
$product->save();
}
}
I'd like to add my WordPress is in Dutch, do I have to use "Gereduceerd Tarief" in this case?