Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

WooCommerce - Custom variable price by product

lorro Feb 10th, 2017 (edited) 97 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top