How to make global metafield for site wide sale

coby_ss
Shopify Partner
3 0 1

For our website, we want to disable certain apps when we are running site wide sales. I'm looking to find a way to add a global metafield or something similar to turn this setting on or off. My only solution so far is putting a metafield on a collection, then for looping over the collections to find that metafield. If true, I assign a variable to use in the liquid files. I'd prefer to have a more global variable rather than putting this value on a collection

Reply 1 (1)

Umiko
Shopify Staff
42 8 13

Hi @coby_ss 👋

 

The `Metafield` object is generally attached to a resource as its `Metafield.owner`. I'd recommend reviewing the `MetafieldOwnerType` list to determine which resource would be best suited for your needs.

 

Hope that helps!

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog