[Bug]: section schema "enabled_on" for metaobject page template
Please confirm that you have:
- [X] Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
- [X] Reproduced the issue in the latest CLI version.
In which of these areas are you experiencing a problem?
Theme
Expected behavior
Working with the new meta object storefront template pages, you should be able to create a theme section that is restricted to only be enabled on or disabled on a specific meta object page template. Example:
To set the enable or disable property to actually render on the storefront theme you have to specify the meta object template type with metaobject/{template name} otherwise Liquid won't render the section. But this syntax throws an error with the CLI.
"enabled_on": {
"templates": ["metaobject/fit_guide", "product"]
},
Actual behavior
CLI throws an error or will not start up watcher when setting the enabled_on property for meta objects according to what will output in Shopify. Example
"enabled_on": {
"templates": ["metaobject/fit_guide", "product"]
},
will cause
• 11:12:24 ERROR » update sections/example.liquid: Invalid enabled_on property: templates[0]: must be one of 404, cart, checkpoint, gift_card, list-collections, password, queue, search, article, blog, collection, page, product, metaobject, customers/account, customers/activate_account, customers/addresses, customers/login, customers/order, customers/register, customers/reset_password, index
Verbose output
npm run dev:restart -- --verbose
> [email protected] dev:restart
> npm run shopify:push -- --nodelete && npm run dev:watch --verbose
> [email protected] shopify:push
> env-cmd -x shopify theme push --store \$store --development --path dist --nodelete
┏━━ Pushing theme files to Development (9eb48d-Jamieson) (#125829513303) on dev-ca-saxx.myshopify.com ━━━━━━━━━━━━━━━━━
┃ 100%
┃ sections/job-post.liquid: Invalid enabled_on property: templates[0]: must be one of 404, cart, checkpoint, gift_card, list-collections, password, queue, search, article, blog, collection, page, product, metaobject, customers/account, customers/activate_account, customers/addresses, customers/login, customers/order, customers/register, customers/reset_password, index
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (7.63s) ━━
Reproduction steps
- Create a section
- Create a meta object that will output a storefront page and create the meta object template in the CMS.
- Set the
enabled_onconfiguration on the section to the required configuration to restrict that section to that meta object template eg:
"enabled_on": {
"templates": ["metaobject/fit_guide", "product"]
}
- Attempt to run
shopify theme pushand observe error regarding a non validenabled_onconfiguration
Operating System
Mac OS Sonoma 14.2.1
Shopify CLI version (check your project's package.json if you're not sure)
3.56.2
Shell
No response
Node version (run node -v if you're not sure)
v20.10.0
What language and version are you using in your application?
No response
As a note to any one that comes across this, as a temporary workaround, I'm using negative logic to restrict the section output to only be for meta object templates. Example:
"disabled_on": {
"templates": [
"404",
"article",
"blog",
"cart",
"collection",
"list-collections",
"customers/account",
"customers/activate_account",
"customers/addresses",
"customers/login",
"customers/order",
"customers/register",
"customers/reset_password",
"gift_card",
"index",
"page",
"product",
"password",
"search"
],
"groups": ["*"]
},
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
hi @JamiesonRoberts, thanks for reporting this issue 🙏 the fix for this problem actually won’t live on Shopify CLI, so we’ve forwarded your case to the proper team internally, but we’re closing this issue here. thanks for sharing this scenario and stay tuned on https://shopify.dev/changelog to get new updates about this
OP's issue still exsists, I'm running into exactly the same errors.
Shopify CLI 3.74.0
The enabled_on should really allow one to limit sections to specific templates, including template suffixes "page.contact" "metaobject.locations" etc.