Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // credit: http://snippet.fm/snippets/hide-max-price-for-variable-products-in-woocommerce/
- add_filter( 'woocommerce_variable_sale_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
- add_filter( 'woocommerce_variable_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
- function hide_variable_max_price( $price, $_product ) {
- $min_price_regular = $_product->get_variation_regular_price( 'min', true );
- $min_price_sale = $_product->get_variation_sale_price( 'min', true );
- return ( $min_price_sale == $min_price_regular ) ?
- 'From '. wc_price( $min_price_regular ) :
- '<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>From ' . wc_price( $min_price_sale ) . '</ins>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement