No price at the product page

New Member
6 0 0

Hi,

 

I followed the code toget customers to choose an option in this tutorial https://help.shopify.com/en/themes/customization/products/variants/how-to-add-a-pick-an-option-to-dr... and now my prices are hidden on product page unless you choose variant before. I would like them to be shown as before for the first and cheapest variant. How can I do that?

 

They have done it in demo https://donnelly-farrell8252.myshopify.com/products/comfort-plus

 

I am using Debut theme.

 

Best regards,

Juraj

0 Likes
Highlighted
Shopify Partner
1348 156 239

This behavior is expected as per the note from the tutorial you've linked:

Because this customization prevents a variant from being selected by default, your theme may not show a product price until after the customer selects a variant. This is expected behaviour, because products with variants do not have a featured price. The price that is displayed is determined by the variant that is selected.

And besides, I don't think there is any logic as to which variant they select (cheaper/most expensive), they just choose the price of the first variant.

 

As you are using the free theme from Shopify you have a free hour of support from their team so you might want to reach out to them and ask for that bit of code that is showing a default price - https://help.shopify.com/en/manual/using-themes/theme-support

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
New Member
6 0 0
Hi Sergiu,

I know that, but I asked here because someone maybe knows that bit of code to show it. I contacted the support, but I didn’t get my answer in more than 48 hours and I am loosing customers and sales in the meantime, because they go away if they don’t see the price. If someone can help, I think it would be great for other users here, because there was a lot of similar question but no answer on this community forum.
0 Likes
Highlighted
Shopify Partner
1348 156 239

They have this piece of code that handles the case when no variant is selected:

Shopify.OptionSelectors.prototype.initDropdown = function() {
    var t = {
        initialLoad: !0
    };
    if (!this.selectVariantFromDropdown(t)) {
        var e = this;
        setTimeout(function() {
            e.selectVariantFromParams(t) || e.fireOnChangeForFirstDropdown.call(e, t)
        })
    }
}
,
Shopify.OptionSelectors.prototype.fireOnChangeForFirstDropdown = function(t) {
    this.selectors[0].element.onchange(t)
}

Specifically the fireOnChangeForFirstDropdown function, which is taking the first item in the drop down and simulates a selection for it.

 

Without access to the code, providing a working solution for your theme would be challenging.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
New Member
6 0 0
Dear Sergiu,

Thanks a lot! I will send them that and ask if they can implement the solution.

Best regards,
Juraj
0 Likes