How to get the collection name of a product from an AJAX call

New Member
1 0 0

Unfortunately, I don't have access to templates to include the collection's name directly inside the page, so I'd like to see if it's possible to use an AJAX call to get information about the product displayed in the page that also includes the collection's name of the product

The GET call to /products/<product-handle>.js doesn't seem to contain information about its collection:

So my question is: how can we get in javascript the name of the collection of the product displayed in the page? I could look at the url for the "/collections" substring, but it's not always present for some pages