Which Liquid syntax would you use to create a money formatted 'price' variable? 💰

### Explanation When you need to store a formatted value for reuse, you need to use `{% assign %}` with logic tags. Key points: - Wrong approaches: - `{{ product.price | money }}` - Outputs directly, doesn't create a variable - `{{ money_format }}` - Not a valid Liquid filter - `{%- as money -%}` - Invalid syntax - Correct approach: ```liquid {% assign price = product.price | money %} {{ price }} {% assign sale_price = product.compare_at_price | money %} {% assign current_price = product.price | money %} {% if product.compare_at_price > product.price %} {{ sale_price }} {{ current_price }} {% else %} {{ current_price }} {% endif %} ``` Reference: [Shopify Liquid Variables](https://shopify.dev/docs/api/liquid/basics/variables)

Answer Options:

  • {{ money_format product.price }}
  • {% assign price = product.price | money %}
  • {{ price = product.price | money }}
  • {%- product.price as money -%}
Shopify Free Test
← PreviousQuestion 1 of 1Finish →
00
← PreviousFinish →
Copyright ©Michael Bollin. Found some mistake?[email protected]