Home Forums Plugins CURCY – WooCommerce Multi Currency Plugin Breaks Code used to hide price range

Plugin Breaks Code used to hide price range

  • Author
    Posts
  • #127386

    Lance Liao
    Participant

    add_filter(‘woocommerce_get_price_html’, ‘hide_variation_price’, 10, 2);

    function hide_variation_price( $price, $product ) {
    $product_types = array( ‘variable’);
    if ( in_array ( $product->product_type, $product_types ) && is_product() ) {

    $min_price = $product->get_variation_price(‘min’, true );
    $max_price = $product->get_variation_price(‘max’, true );

    if($min_price !== $max_price) {
    return ”;
    }

    }
    // return regular price
    return $price;
    }

    Been using this code to hide price range on variable products, this plugin breaks it and shows price range: $$$ – $$$

You must be logged in to see replies to this topic. Click here to login or register