When will this Liquid code output the variant price? 🛍️ ```liquid {%- if product.selected_variant -%} {{ product.selected_variant.price | money }} {%- endif -%} ```

### Explanation The `product.selected_variant` object is specifically tied to URL parameters: - Only populated when `?variant=123456789` is present in the URL - Returns `nil` if no variant parameter exists - Not affected by JavaScript variant selection (would need page reload) - Does not automatically select first variant - Common usage: maintaining variant selection after page refresh Example URL: `https://store.myshopify.com/products/t-shirt?variant=123456789` Reference: [Shopify Product Object](https://shopify.dev/docs/api/liquid/objects/product)

Answer Options:

  • When a variant is selected using JavaScript in the browser
  • When the URL includes a ?variant= parameter
  • On every product page load, product has always a selected_variant
  • Only when viewing the first variant of a product
Shopify Free Test
← PreviousQuestion 1 of 1Finish →
00
← PreviousFinish →
Copyright ©Michael Bollin. Found some mistake?[email protected]