Display product details (template, section and form) on App Proxy

Highlighted
Tourist
5 0 1

I want to render the Product page along with some custom information when I hit my App Proxy URL and return liquid from it. 

 

res.set('Content-Type', 'application/liquid')

var response = `Proxy page for {{ shop.name }}
{% for product in collections['all'].products %} - 
{{ product.title }} {% if product.title == #condition %} {% assign template = 'product' %} {% section 'product-template' %} {% endif %} {% endfor %} `

If I run this then the below error comes on my store page. The line points to where my form starts inside product-template. How do I make sure the form and product details (image, title, price, etc.) loads? In my understanding, the {% section 'product-template' %} line should render everything correctly as I am passing the 'product'.

 

Liquid error (line ###): product form must be given a product

The product.title and shop.name are being correctly rendered.

 

If I try to send a new form/ layout after the 'section' line then it displays product details correctly but I want to use the already present 'product-template'.

0 Likes
Tourist
5 0 1

Can anyone help here? 

0 Likes
Shopify Expert
3994 14 321

If you read the documentation, the very first thing they show you is that you cannot do what you are trying to do with that pattern.

 

Variables created outside sections are not available within sections. Likewise, variables created in sections are not available outside sections. If a section includes a snippet, the snippet has access to the variables in the section.

 

So it looks like you are going to have to adjust your pattern to suit the needs.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes