How to query all the images present in (product variant, blogs, homepage, saved files) in the shop?

Highlighted
Excursionist
20 2 2

Is there a way to get all the images of a shop at once? I think it would be possible with graphql bulk query.

0 Likes
Tourist
25 2 4

Hi, I unfortunately can't help you get everything with one solution, if the solution exists it's a bit beyond my knowledge area, but in case it's helpful I wanted to put this idea in front of you for the products piece:

 

You could use liquid forloop to get all the images of all products by creating a new "All Products" collection using a condition like product price greater than -1 ought to do it, then create a new collection template like "collection.all-product-images.liquid" with the below code, then set the new All Product collection to that all-product-images template. Whenever you view that collection, it will be a paginated list of all the store's product images.

 

{%- layout none -%}

{%- paginate collection.products by 1000 -%}
<p>{%- if paginate.current_page == 1 -%}{%- else -%}<a href="{{ paginate.previous.url }}">Previous</a> - {%- endif -%}{{ paginate.current_page }} / {{ paginate.pages }} - <a href="{{ paginate.next.url }}">Next</a></p>

	{%- for product in collection.products -%}
		{%- for image in product.images -%}
			<div>{{ image | product_img_url: 'large'}}</div>
		{%- endfor -%}
	{%- endfor -%}

{%- endpaginate -%}

As for getting all files, this post by @Jason might be helpful:

https://freakdesign.com.au/blogs/news/113610119-export-a-list-of-all-files-in-the-shopify-admin

 

Hope that helps any

0 Likes
Excursionist
20 2 2

Hello! Thanks for the reply. But I want to store all the image files originalSrc url to my database when the shop installs my app. I won't be able to do that using this.

0 Likes