How to Retrieve Collections Associated with a Specific Product Using Shopify Storefront API?

I’m working on a Shopify project and need to find all the collections associated with a specific product using its Product ID. For example, if “Red T-shirt” is a product that belongs to multiple collections, I want to retrieve the list of those collections.

Is it possible to achieve this using the Shopify Storefront API? If yes, which query or endpoint should I use? Are there any specific parameters or best practices for this use case?

Any help or sample code would be greatly appreciated.

This is an interesting one. Definitely worth a try and I would be looking forward to this.