Shopify themes, liquid, logos, and UX
Looking to change the From price in the collection, to a range in Symmetry Theme, this is the place I need to change it, just not sure what to change it to:
<div class="price__default"> {%- if product.price_varies -%} {%- if for_variant_picker == false -%} <span class="price__from">{{ 'products.product.from' | t }}</span> {%- elsif for_variant_picker and current_variant == false -%} <span class="price__from">{{ 'products.product.from' | t }}</span> {%- endif -%} {%- endif %}
Hi @chels_grove ,
I think the range need to modify the code to calculate and display the minimum and maximum prices of the product variants.
You need to Replace the current code snippet by this way:
<div class="price__default">
{%- if product.price_varies -%}
{%- assign min_price = product.price_min | money %}
{%- assign max_price = product.price_max | money %}
{%- if for_variant_picker == false -%}
<span class="price__range">
{{ min_price }} - {{ max_price }}
</span>
{%- elsif for_variant_picker and current_variant == false -%}
<span class="price__range">
{{ min_price }} - {{ max_price }}
</span>
{%- endif -%}
{%- endif %}
</div>
The {{ min_price }} - {{ max_price }} line displays the price range.
After making these changes, the product's price will display as a range (e.g., "$10.00 - $20.00") instead of just showing "From" a certain price.
I hope these instructions will help you. If they are helpful, please give us likes and mark as the solution.
Have a nice day sir!
If our suggestions are useful, please let us know by giving it a like, marking it as a solution.
BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
Thanks @BSSCommerce-B2B - that worked for the collection page great, but then when I go to the product page, no price shows.
HI @chels_grove ,
Thank for your feedback!
We're happy to see that our suggestion helped you solve the issue.
Sr about my little mistake, if you want it worked for the collection page only, you need to add condition for this script like that below:
<div class="price__default">
{%- if product.price_varies -%}
{%- if for_variant_picker == false or (for_variant_picker and current_variant == false) -%}
{%- if template.name == 'collection' -%}
<span class="price__range">
{{ product.price_min | money }} - {{ product.price_max | money }}
</span>
{%- else -%}
<span class="price__from">{{ 'products.product.from' | t }}</span>
{%- endif -%}
{%- endif -%}
{%- endif %}
</div>
Condition: (template.name == 'collection') checks if the current template is a collection page. If you're on a collection page, it displays the price range.
On other pages, like the product page, it falls back to the original "From" price or other your pricing logic.
Try this out...
Hope it helps!
I hope these instructions will help you. If they are helpful, please give us likes and mark as the solution.
Have a nice day sir!
If our suggestions are useful, please let us know by giving it a like, marking it as a solution.
BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024