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

WooCommerce - Hide variable max price

lorro Aug 11th, 2015 (edited) 780 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <?php
  2.   // credit: http://snippet.fm/snippets/hide-max-price-for-variable-products-in-woocommerce/
  3.   add_filter( 'woocommerce_variable_sale_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
  4.   add_filter( 'woocommerce_variable_price_html',      'hide_variable_max_price', PHP_INT_MAX, 2 );
  5.   function hide_variable_max_price( $price, $_product ) {
  6.     $min_price_regular = $_product->get_variation_regular_price( 'min', true );
  7.     $min_price_sale    = $_product->get_variation_sale_price( 'min', true );
  8.     return ( $min_price_sale == $min_price_regular ) ?
  9.       'From '. wc_price( $min_price_regular ) :
  10.       '<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>From ' . wc_price( $min_price_sale ) . '</ins>';
  11. }
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