daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Jan 12th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter( 'template_include', function( $template ) {
  2.  
  3.  if ( has_term( 'fabric-offers', 'product_cat' ) ) {
  4.  
  5.  add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
  6.     function add_custom_price( $cart_object ) {
  7.          $custom_price = 50; // This will be your custome price  
  8.          foreach ( $cart_object->cart_contents as $key => $value ) {
  9.             $value['data']->price = $custom_price;
  10.          }
  11.  
  12.      }
  13.  
  14.     }
  15.     return $template;
  16.  
  17.     });
RAW Paste Data
Top