New Landing How can we help? Themeforest Theme Support Neighborhood Remove variable product price range from category page

Viewing 6 posts - 1 through 6 (of 6 total)
  • #124929
    Jesper Billeskov
    Member
    Post count: 28

    Hi Swift,

    I’m having some issues when I’m making variable products. On the category page it shows the product’s full price range and not only the lowest possible price, which I prefer. I have tried adding this under Theme Options -> General Options -> Custom CSS: https://gist.github.com/kloon/8981075. But nothing changes.

    If you’re sure what I mean, please have a look on this page: http://skateshop.dk/produkt-kategori/skateboards/
    The first product is a variable product and the second is a composite product. The composite product’s price is shown in the right way (“Fra: 450 kr.”). How do I make the variable product’s price look in the same way in stead of showing the full price range?

    Looking forward to your reply.

    Cheers
    Jesper

    #124952
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please insert this code should at functions.php of your child theme.

    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
     
    function custom_variation_price( $price, $product ) {
    $price = '';
     
    if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
    $price .= woocommerce_price($product->get_price());
    if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {
    $price .= '<span class="to"> ' . _x('to', 'max_price', 'woocommerce') . ' </span>';
     
    $price .= woocommerce_price($product->max_variation_price);
    }
     
    return $price;
    }

    Thanks
    Mohammad

    #125003
    Jesper Billeskov
    Member
    Post count: 28

    Hi Mohammad!

    Thanks for your reply.

    I was not using a child theme before. In order not to mess everything up on http://skateshop.dk I tried activating a child theme on another website http://fixfix.dk.

    I used this guide to make and activate the child theme: http://codex.wordpress.org/Child_Themes

    Now I have 2 questions:

    1. The code that you gave me is almost working as you can see on the first product on http://fixfix.dk. However, I want it to say “From: 499kr.” and not “From: 499kr. to 519kr.”. How do I remove that last part?

    2. All the product thumbnails mysteriously became smaller when I activated the child theme. I have uploaded an image of what it looked like before. What did I do wrong and how do I fix this?

    Looking forward to your reply.

    Cheers
    Jesper

    Attachments:
    You must be logged in to view attached files.
    #125389
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Try this instead:

    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
     
    function custom_variation_price( $price, $product ) {
    $price = '';
     
    if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
    $price .= woocommerce_price($product->get_price());
    
    return $price;
    }

    – Kyle

    #125440
    Jesper Billeskov
    Member
    Post count: 28

    Hi!

    I created a child theme for Skateshop.se and with the new code everything looks the way I want it to! Thanks guys ๐Ÿ™‚

    #125443
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    No problem ๐Ÿ™‚

    – Kyle

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register