getting product image from js

mysz123
New Member
1 0 0

Hey,
There is way to get the products images from js in product page without
touch the product.liquid?

 

Thanks!

Alon Golan

0 Likes
PaulNewton
Shopify Partner
2983 168 537

https://shopify.dev/docs/themes/ajax-api/reference/product

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes

Yes. Every product has a JSON endpoint which contains the image's URL in it plus much more data.

For example, this product:

https://colourpop.com/products/glisten-up-vitamin-c

Can have most of its information viewed by adding .json at the end of the URL.

https://colourpop.com/products/glisten-up-vitamin-c.json

You just need to do a GET call of the product you want and get the image.
Naturally it requires basic Javascript knowledge to do so which is beyond the scope of this answer.

Kind regards,
Diego

◦ Slideshow section not looking good? Try the Slideshow (PRO) section. No apps required.
◦ Product page images slider for free themes (w/ 20+ customization options): Minimal | Debut | Brooklyn | Supply
◦ If my answer helps you please click on like and Accept as solution!
0 Likes