What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to make global metafield for site wide sale

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 14

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