Skip to main content
Glama
variant.md5.83 kB
# Liquid Objects: Variant A [product variant](https://help.shopify.com/manual/products/variants). ## Properties ### available **Type:** boolean Returns `true` if the variant is available, `false` otherwise. ### barcode **Type:** string The barcode of the variant. ### compare_at_price **Type:** number The compare-at price in the currency's subunit, displayed in the customer's local currency. For currencies without subunits (JPY, KRW), tenths and hundredths are appended. **Tip:** Use money filters to format prices. ### featured_image **Type:** image The image attached to the variant (same as `variant.image`). ### featured_media **Type:** media The first media object attached to the variant. ### id **Type:** number The variant's ID. ### image **Type:** image The image attached to the variant (same as `variant.featured_image`). ### incoming **Type:** boolean Returns `true` if the variant has incoming inventory. Populated by inventory transfers, purchase orders, and third-party apps. ### inventory_management **Type:** string The inventory management service. Returns `nil` if inventory isn't tracked. ### inventory_policy **Type:** string (enumerated) Controls whether selling continues when out of stock: - `continue` – Keep selling when out of stock - `deny` – Stop selling when out of stock ### inventory_quantity **Type:** number The current inventory quantity, or number of items sold if inventory isn't tracked. ### matched **Type:** boolean Returns `true` if matched by a storefront filter or no filters are applied. ### metafields **Type:** metafields array Applied metafields. See the Shopify Help Center for creation details. ### next_incoming_date **Type:** string Arrival date for the next incoming inventory. Use the `date` filter to format. ### options **Type:** product_option_value array The variant's values for each product option. **Example:** ```liquid {% for variant in product.variants -%} {%- capture options -%} {% for option in variant.options -%} {{ option }}{%- unless forloop.last -%}/{%- endunless -%} {%- endfor %} {%- endcapture -%} {{ variant.id }}: {{ options }} {%- endfor %} ``` ### price **Type:** number The variant's price in the currency's subunit, in the customer's local currency. **Tip:** Use money filters for formatted output. ### product **Type:** product The parent product object. ### quantity_price_breaks **Type:** quantity_price_break array Quantity price break objects in the current customer context. ### quantity_price_breaks_configured? **Type:** boolean Returns `true` if the variant has quantity price breaks available. ### quantity_rule **Type:** quantity_rule The quantity rule for the variant. Defaults to `min=1,max=null,increment=1`. Set via B2B catalogs. ### requires_selling_plan **Type:** boolean Returns `true` if the product requires a selling plan for cart additions. ### requires_shipping **Type:** boolean Returns `true` if the variant requires shipping. ### selected **Type:** boolean Returns `true` if currently selected (determined by the `variant` URL parameter on product pages). ### selected_selling_plan_allocation **Type:** selling_plan_allocation The selected selling plan allocation, or `nil` if none selected (determined by `selling_plan` URL parameter). ### selling_plan_allocations **Type:** selling_plan_allocation array All selling plan allocation objects for the variant. ### sku **Type:** string The variant's SKU. ### store_availabilities **Type:** store_availability array Store availability data. Only defined when the variant is selected or is the product's first available variant. ### taxable **Type:** boolean Returns `true` if taxes apply to the variant. ### title **Type:** string Concatenation of variant options separated by `/`. **Example:** ```liquid {{ product.variants.first.title }} ``` Output: `S / Low` ### unit_price **Type:** number The unit price reflecting applied discounts, in the currency's subunit. **Tip:** Use `unit_price_with_measurement` filter with `variant.unit_price_measurement`. ### unit_price_measurement **Type:** unit_price_measurement The unit price measurement data. **Tip:** Combine with `variant.unit_price` using the `unit_price_with_measurement` filter. ### url **Type:** string The variant URL structure: `/products/[product-handle]?variant=[variant-id]` ### weight **Type:** number Weight in grams. Use the `weight_with_unit` filter to format. ### weight_in_unit **Type:** number Weight in the unit specified by `variant.weight_unit`. ### weight_unit **Type:** string The unit for the variant's weight. Use with `weight_in_unit` and the `weight_with_unit` filter. ## Deprecated Properties ### option1, option2, option3 **Type:** string The values for the first, second, and third product options. **Status:** Deprecated. Use `variant.options` instead. --- ## Example JSON ```json { "available": true, "barcode": "", "compare_at_price": null, "featured_image": null, "featured_media": null, "id": 39897499729985, "image": null, "incoming": false, "inventory_management": "shopify", "inventory_policy": "deny", "inventory_quantity": 5, "matched": true, "metafields": {}, "next_incoming_date": null, "option1": "S", "option2": "Low", "option3": null, "options": [], "price": "10.00", "product": {}, "quantity_price_breaks": [], "quantity_rule": {}, "requires_selling_plan": false, "requires_shipping": true, "selected": false, "selected_selling_plan_allocation": null, "selling_plan_allocations": [], "sku": "", "store_availabilities": [], "taxable": true, "title": "S / Low", "unit_price": null, "unit_price_measurement": null, "url": {}, "weight": 500, "weight_in_unit": 500, "weight_unit": "g" } ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/florinel-chis/shopify-liquid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server