daily pastebin goal
78%
SHARE
TWEET

WooCommerce - Custom variable price by product

lorro Feb 10th, 2017 (edited) 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
Top