Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Remove variable product price range from category page
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Remove variable product price range from category page
- This topic has 5 replies, 3 voices, and was last updated 9 years by Kyle – SUPPORT.
-
Posted in: Neighborhood
-
November 2, 2014 at 11:00 pm #124929
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
JesperNovember 3, 2014 at 4:26 am #124952Hi,
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
MohammadNovember 3, 2014 at 9:36 am #125003Hi 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
JesperAttachments:
You must be logged in to view attached files.November 4, 2014 at 10:38 am #125389Hi
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
November 4, 2014 at 12:22 pm #125440Hi!
I created a child theme for Skateshop.se and with the new code everything looks the way I want it to! Thanks guys ๐
November 4, 2014 at 12:29 pm #125443No problem ๐
– Kyle
-
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.