Answers for "Woocommerce Show only one price for variable product"

0

display only price from selected variable woocommerce

add_action('woocommerce_before_add_to_cart_form', 'selected_variation_price_replace_variable_price_range');
function selected_variation_price_replace_variable_price_range(){
    global $product;

    if( $product->is_type('variable') ):
    ?><style> .woocommerce-variation-price {display:none;} </style>
    <script>
    jQuery(function($) {
        var p = 'p.price';

        $('form.cart').on('show_variation', function( event, data ) {
            $(p).html(data.price_html);
        }).on('hide_variation', function( event ) {
            $(p).html($(a).html());
        });
    });
    </script>
    <?php
    endif;
}
Posted by: Guest on March-05-2021

Code answers related to "Woocommerce Show only one price for variable product"

Browse Popular Code Answers by Language