Home Forums WoodMart support forum Price range (variable products)

Price range (variable products)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #625018

    john_charalambidis
    Participant

    Hie.

    We have set a new store, there are many variable products with wide range of prices depending on the sizes, we would like to have the option to apply to all variable products a name “From-To” e.g (Room Divider – A breath of summer “From 192,19 € To: 362,07 €” .
    The template itself have the option to show the range of prices, but without mentioning “From-To” there are misunderstandings.

    Thanks in advance.

    #625021

    john_charalambidis
    Participant

    For the time being, we have set ( “Hide “to” price) for Variable products, to avoid issues with costumers, since they thought it was wrong price input.

    I will add the Screenshots–>

    Attachments:
    You must be logged in to view attached files.
    #625135

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    To add “From-To” before the price range on variable products, you can use the following custom code in your child theme’s functions.php file:

    add_filter('woocommerce_variable_price_html', 'custom_variable_price_format', 10, 2);
    function custom_variable_price_format($price, $product) {
        $min_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('min')]);
        $max_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('max')]);
        $price = sprintf(__('From %s To %s', 'woocommerce'), wc_price($min_price), wc_price($max_price));
        return $price;
    }

    This will display the price range in the “From-To” format for all variable products.

    Best Regards

    #625201

    john_charalambidis
    Participant

    Thanks for your support.
    It worked perfect !! , but we prefer instead of showing from – to, showing only the starting price “From”. We have few products that belong to variable products with same price range and it looks a mess, and sounds like a better marketing idea.

    Could you please reproduce the code with these characteristics only “From” ?
    Thanks in advance.

    #625240

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    You can use the following custom code in your child theme’s functions.php file:

    add_filter('woocommerce_variable_price_html', 'custom_variable_price_from', 10, 2);
    function custom_variable_price_from($price, $product) {
        $min_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('min')]);
        $price = sprintf(__('From %s', 'woocommerce'), wc_price($min_price));
        return $price;
    }

    Best Regards

    #625355

    john_charalambidis
    Participant

    Thank you so much.

    it worked perfectly.
    Merry Christmas and all the best

    #625389

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Most Welcome!!!.

    I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.

    We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Price range (variable products)’ is closed to new replies.