Rounding up prices for the specified categories
1 2 3 4 5 6 7 8 9 10 11 |
add_filter( "wdp_custom_override_cents", function ( $custom_price, $price, $context, $product ) { # exclude if ( count( array_intersect( array( 1, 2, 3 ), $product->get_category_ids() ) ) > 0 ) { return $custom_price; } # include if ( count( array_intersect( array( 3, 4, 5 ), $product->get_category_ids() ) ) > 0 ) { $custom_price = round( $price - 0.05, 1 ); } return $custom_price; }, 10, 4 ); |