Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'template_include', function( $template ) {
- if ( has_term( 'fabric-offers', 'product_cat' ) ) {
- add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
- function add_custom_price( $cart_object ) {
- $custom_price = 50; // This will be your custome price
- foreach ( $cart_object->cart_contents as $key => $value ) {
- $value['data']->price = $custom_price;
- }
- }
- }
- return $template;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement