Advertisement
lorro

WooCommerce - Custom variable price by product

Feb 10th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.   // Custom variable price by product
  3.   // code goes in functions.php for your child theme
  4.   add_filter( 'woocommerce_variable_sale_price_html', 'custom_variable_price', 40, 2 );
  5.   add_filter( 'woocommerce_variable_price_html',      'custom_variable_price', 40, 2 );
  6.   function custom_variable_price( $price, $_product ) {
  7.     $product_id = $_product->id;
  8.     switch ($product_id) {
  9.       case 1569:
  10.         return 'From $0.80 per item';
  11.       default:
  12.         return $price;
  13.     } // end switch
  14.   } // end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement