Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  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. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement