I’m trying to make a quick cheat code to mark porducts as out of stock on my store, even tho when they are in stock on the system.
I’ve created the “True or False” variante metafield: variant.metafields.custom.sold_out
And i’m trying to use the following code:
{%- liquid
assign default_text = 'products.product.add_to_cart' | t
assign button_text = 'products.product.add_to_cart' | t
if template contains 'preorder'
assign default_text = 'products.product.preorder' | t
assign button_text = 'products.product.preorder' | t
endif
unless current_variant.available and current_variant.metafield.custom.sold_out != 'true'
assign button_text = 'products.product.sold_out' | t
endunless
-%}
<button
{% if product.empty? %}type="button"{% else %}type="submit"{% endif %}
name="add"
data-add-to-cart
class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}"
{% unless current_variant.available and current_variant.metafields.custom.sold_out != 'true' %} disabled="disabled" {% endunless %}>
<span data-add-to-cart-text data-default-text="{{ default_text }}">
{{ button_text }}
</span>
</button>
But that doesn’t seem to work, can anyone help me with this?