Shopify / dawn

Shopify's first source available reference theme, with Online Store 2.0 features and performance built-in.
Other
2.48k stars 3.32k forks source link

Opengraph price can be incorrect when there are multiple variants that have different prices #924

Open erlendd opened 2 years ago

erlendd commented 2 years ago

Describe the current behavior When loading a page with multiple variants (which differ in price) the line can be wrong, i.e. pertaining to the wrong variant.

Describe the expected behavior should reflect the selected variant.

Version information (Dawn, browsers and operating systems)

Possible solution

Additional context/screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

erlendd commented 2 years ago

I think perhaps a solution might be to change the line https://github.com/Shopify/dawn/blob/main/snippets/meta-tags.liquid#L32 from <meta property="og:price:amount" content="{{ product.price | money_without_currency | strip_html }}"> to <meta property="og:price:amount" content="{{ product.selected_or_first_available_variant.price | money_without_currency | strip_html }}"> I'm not a Shopify expert though.

ludoboludo commented 2 years ago

Hello @erlendd 👋 , thanks for taking the time to look into this issue and post here about it.

I think you're right with you're potential fix. Would be a quick fix that shows the price of the current product/variant on the page.

I will try and get the issue triaged so we can then take a look at it 👍