PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 1, 2022

[FIXED] How can I call product image, details, and price on the section page in Shopify?

 July 01, 2022     liquid, schema, shopify     No comments   

Issue

{% for block in section.blocks %}
{% for image in product.images %} {{ image.src | product_img_url: 'grande' }} {% endfor %}
{{block.settings.product.title}}
{{all_products[product].price | money_without_trailing_zeros }}
{% endfor %}

{% schema %}
{
"name": "Demo",
"blocks": [
{
"type": "new-arrival",
"name": "New Arrival",
"settings": [
{
"type": "product",
 "id": "product",
"label": "Product"
}

]
 }
]
}
{% endschema %}

Can anyone tell me how can I call multiple product images, product details, and product prices on the section page? Here some code that I try but it's not correct.


Solution

Thank You for guide Onkar. I update a little bit now it properly works.

{% for block in section.blocks %}
   {% assign product = all_products[block.settings.product] %}
   {% for image in product.images %} 
        <img src="{{ image.src | product_img_url: 'grande' }}" >
      {{product.title}}
      {{ product.price | money_without_trailing_zeros }} 
      {{product.description}}
   {% endfor %}
   
{% endfor %}



Answered By - Anupam Mistry
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing