Is it possible to use choices from a MetaObject definition in a section schema?

Is it possible to use choices from a MetaObject definition in a section schema?

roberkules
Shopify Partner
1 0 0

Let's say I have a testimonial MetaObject with a field "type" that's limited to preset choices like

  • Product Review
  • Customer Experience

Now I would like to create a testimonials.liquid section with a setting where I can pick the testimonial type. Ideally I don't need to duplicate the choices.

 

So my question is, is there any way of accessing the choices from the metaobject, something like this:

 

 

{% schema %}
{
  "name": "Testimonials",
  "class": "section",
  "tag": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [
    {
      "type": "shop.metaobjects.testimonials.type",  // <<<< THIS
      "id": "type",
      "default": "Product Review",
      "label": "Type",
    },

 

 

Reply 1 (1)

soniya-01
Tourist
8 0 1

In general, the ability to use choices from a MetaObject Definition in a Section Schema would depend on the capabilities and features of the technology or framework you are working with. Here are a few scenarios where such concepts might be relevant:

  1. Web Development (Frontend Frameworks): If you are working with a frontend framework like React, Angular, or Vue.js, you might be dealing with component schemas or metadata definitions. In this case, the ability to use choices from a meta-object definition in a section schema would depend on the specific tools or libraries you are using.

  2. Data Modeling (Database Schema Definition): If you are referring to a backend scenario where you are defining database schemas using a tool like Django ORM, SQLAlchemy, or similar frameworks, the concept of using choices from a meta-object definition in a section schema might be relevant to how you define fields and constraints.

  3. API Development (OpenAPI, GraphQL): In the context of API development, you might be working with OpenAPI specifications or GraphQL schemas. Choices and constraints might be defined in meta-objects and used in section schemas or types.