I’m trying to display a custom back-in-stock timing message on my site when a variant has an inventory count <= 0. I’m using the Boost theme with the Inventory Notice turned on and my variants are set to NOT ‘continue selling when out of stock’. I want to use variant metafields to toggle and display a special message when the variant is out of stock. I would prefer the messaging to be variant-specific, but I can make do with product messaging if trying to do this at the variant level will require extra coding.
I’ve created 2 variant metafields: one (single line text) for the message and one (True/False) metafield to simplify the administration – a quick On/Off toggle. It isn’t working. I thought it might be due to a javascript issue with the variant selection. So, I tried using product metafields, but that’s not working either. (And yes, I am testing this on a product with <= 0 inventory and the data in the metafields.)
Here’s a code snippet (my insert is commented near the end):
{%- if current_variant.inventory_management != blank and block.settings.show_inventory_notice != ‘never’ -%}
Hi @Kani , thanks for looking at this. I’ve tried using current_variant.metafields… as well, but I’m not sure: is that even possible? Online information about metafields is sorely lacking…
This is all within the Buy Buttons loop where the form has assigned inventory_qty to current_variant.
Here’s the full code from the form, now with current_variant.metafields (which still doesn’t work):