Re: Minimal Theme: Display First Variant Price on Collection Page

Solved

Minimal Theme: Display First Variant Price on Collection Page

WisamTDG
Visitor
2 0 0

Hi ! 

I am quite new at shopify and have minimal coding experience. The issue im facing is that I want the price displayed in the collections page to be the first variant. At the moment it shows the cheapest variant price. For example it shows "From 45.99" but I would like it to display a more expensive variant.  I have seen different solutions to this problem, but I don't know how to apply them to the Minimal theme! Please let me know how i can apply this to the minimal theme.

Store link: https://tdg-inc.ca/

Im guessing the answer is somewhere over here:

{% if featured.title != '' %}
<p class="grid-link__meta">
{%- assign price = featured.price | money -%}

{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s class="grid-link__sale_price">{{ featured.compare_at_price | money }}</s>
{% endif %}
{% if featured.price_varies %}
{{ 'products.general.from_html' | t: price: price }}
{% else %}
{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
{% endif %}
{{ price }}

{%- assign variant = featured.selected_or_first_available_variant -%}
{%- if variant.available and variant.unit_price_measurement -%}
{% include 'product-unit-price', variant: variant, wrapper_class: 'grid-link__unit-price' %}
{%- endif -%}
{% endif %}
</p>
{% endif %}
</a>
</div>

Accepted Solution (1)

LitExtension
Shopify Partner
4860 1002 1157

This is an accepted solution.

Hi @WisamTDG,

Please follow these steps:

- Step 1: Go to Online store > Themes > Actions > Edit code.

- Step 2: Go to snippets > product-grid-item.liquid and add code in line 1. https://i.imgur.com/jucD25M.png
Code: {%- assign variant = featured.selected_or_first_available_variant -%}

- Step 3: Replace 'featured.price' => 'variant.price' and 'featured.compare_at_price' => 'variant.compare_at_price'
https://i.imgur.com/wTW1rRV.png

Hope it is clear to you.

If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify

View solution in original post

Replies 8 (8)

IttantaTech
Shopify Partner
525 55 103

Hello , @WisamTDG 

 

Try to replace this :- {%- assign price = featured.price | money -%}

With this :- {%- assign price = product.first_available_variant.price | money -%}

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com

LitExtension
Shopify Partner
4860 1002 1157

This is an accepted solution.

Hi @WisamTDG,

Please follow these steps:

- Step 1: Go to Online store > Themes > Actions > Edit code.

- Step 2: Go to snippets > product-grid-item.liquid and add code in line 1. https://i.imgur.com/jucD25M.png
Code: {%- assign variant = featured.selected_or_first_available_variant -%}

- Step 3: Replace 'featured.price' => 'variant.price' and 'featured.compare_at_price' => 'variant.compare_at_price'
https://i.imgur.com/wTW1rRV.png

Hope it is clear to you.

If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
WisamTDG
Visitor
2 0 0

Thank you for your solution!! Worked like a charm! 

One more question...the price now says "from (price)". How can I remove the word "from" ?

 

 

Best,

 

Wisam

LitExtension
Shopify Partner
4860 1002 1157

Please find 'products.general.from_html', change {{ 'products.general.from_html' | t: price: price }} => {{ price }}

Refer: https://i.imgur.com/GXEbzlX.png

Hope it is clear to you.

If this answer can help you solve your issue, please mark it as a solution. Thank you and good luck. 

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
IonPillowFight
Tourist
5 0 4

You can also follow these steps:

- Step 1: Go to Online store > Themes > Actions > Edit code.

- Step 2: Go to snippets > card-product.liquid and look for
Code:  
{% render 'price', product: card_product, price_class: '', show_compare_at_price: true %}

- Step 3: Replace this code with

Code: {{ card_product.variants.first.price | money }}

** In case you want to include the currency code in your code replacement, you can modify it like this:

Code: {{ card_product.variants.first.price | money_with_currency }}

Thank you and good luck.

HHAVEN
Visitor
1 0 0

Hello! You wouldn't happen to know how to adjust the default product/variant price displayed to the lowest value, would you? As of right now, all products on the store are displaying the highest costing variant as the default. Thank you for your time.

Kameronmcl
New Member
5 0 0

Hello!  I see you know what to do with this stuff!

 

I'm having the same issue as well but I'm on the Dawn theme.  I don't have the same snippets as Minimal, so how could I go about doing this on my theme?  Thank you!

KabirDev
Shopify Partner
248 61 68

For anyone trying to showcase all product variants and their prices in Shopify collections, here's a video that could help.

 

- Control payment methods visibility at checkout by KlinKode PayRules app.
- Contact me directly at shahriar@kabirdev.com