Advertisement
meetsos

Hide Max Price for Variable Products

Jan 12th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. add_filter( 'woocommerce_variable_sale_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
  3. add_filter( 'woocommerce_variable_price_html',      'hide_variable_max_price', PHP_INT_MAX, 2 );
  4. function hide_variable_max_price( $price, $_product ) {
  5.     $min_price_regular = $_product->get_variation_regular_price( 'min', true );
  6.     $min_price_sale    = $_product->get_variation_sale_price( 'min', true );
  7.     return ( $min_price_sale == $min_price_regular ) ?
  8.         wc_price( $min_price_regular ) :
  9.         '<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>' . wc_price( $min_price_sale ) . '</ins>';
  10. }
  11. // http://snippet.fm/snippets/hide-max-price-for-variable-products-in-woocommerce/
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement