On a product page, I have the product’s vendor name in product.vendor
.
I want to output some more products from the same vendor.
Is there a way to output some more products from the same vendor, without having to manually create a smart collection with those products?
2
Answers
On my mind this can’t be achieved without Ajax query.
You may access a list of products from a vendor by querying the URL:
/collections/vendors/?q={{ product.vendor }}
I’ve not tested what is returned by default for the JSON view:
/collections/vendors/?q={{ product.vendor }}&view=json
Doc reference: https://help.shopify.com/en/themes/liquid/objects/collection#collection-current_vendor
The easiest recipe I can think of is to do the following:
Now when you want to show products all from that vendor, simply show that collection. You also get all the vendors in a shop as shop.vendors, so you could use that list to make your vendor selection process easy on customers.
Do not use Ajax for this. That is silly, slow and not very Shopify-theme-ish!