Re: How to use section schema code in snippet.

How to use section schema code in snippet.

wins
Shopify Partner
1 0 1

I have a file in the section called 'main-cart-items. liquid' where I set a product picker in the schema that can be accessed as section.settings.product. I want to use that product picker information in the snippet/cart drawer to display for example the price, image, and so on. Any idea of how I pass that product picker to my snippet file and use it?

{% schema %}
{
"name": "t: sections.main-cart-items.name",
"settings": [
{
"type": "header",
"content": "t: sections.all.padding.section_padding_heading"
},
{
"type": "range",
"id": "padding_top",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t: sections.all.padding.padding_top",
"default": 36
},
{
"type": "range",
"id": "padding_bottom",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t: sections.all.padding.padding_bottom",
"default": 36
},
{
"type": "text",
"id": "upsell_headline",
"label": "Headline upsell",
"default": "Upsell Product"
},
{
"type": "product",
"id": "upsell_product",
"label": "Select upsell product"
}
]
}
{% endschema %}
Reply 1 (1)

Nardu_M
Shopify Partner
9 0 1

Here's a post that explains some of the detail.
But to summarize, when your section has the {{ render mysnippet }} you can pass objects to the snippet. (Note, this example won't work as is)

So {{ render mysnippet, price: product.price, image: product_image, handle: product handle }}

It is important to note that the key in each of these key value pairs, must have a name which is not the same as an existing object on the product.

https://community.shopify.com/c/technical-q-a/passing-a-section-schema-variable-to-a-snippet/m-p/142...