Home About Blog Terms Docs Contact

Pre-order liquid variable / Shopify metafield

 

The pre-order liquid variable is useful when you need to run Shopify theme code specifically for products on pre-order

 

PreProduct adds a Shopify metafield whenever a product has a pre-order listing created. Then removes it when the listing is finished. Namely: product.metafields.preproduct.preorder

 

To add logic/elements to products on pre-order, you can use the following: 

 

{% if product.metafields.preproduct.preorder %}
    This sentence only loads when a product is on pre-order.
{% endif %}

 

 

….and the opposite is possible too. To only add logic/elements when a product isn’t on pre-order, you can add the following:

 

{% unless product.metafields.preproduct.preorder %}
    This sentence only loads when a product is not on pre-order.
{% endunless %}