New Shopify Certification now available: Liquid Storefronts for Theme Developers

Shopify admin API, get product theme templates

BohdanNikitchuk
Shopify Partner
5 0 1

Hello,
How can I get a list of available product template options via Shopify admin APIs (Rest or Graphql)? 
In ProductInput fields (for product update/create mutation) we have a templateSuffix field to set, but I cannot find a way to get the list of all available product templates.
In Shopify admin, we have the block for it, that retrieves availableProductTemplateOptions array. I need the same but via admin API. Look at the screenshot:

BohdanNikitchuk_0-1691496716299.png

 

Replies 4 (4)
DavidT
Shopify Partner
22 1 6

Hello, did you find a solution for this?

BohdanNikitchuk
Shopify Partner
5 0 1

Unfortunately, no

DavidT
Shopify Partner
22 1 6

Someone just shared a solution with me. Apparently, you get them with the Assets API: https://shopify.dev/docs/api/admin-rest/2023-07/resources/asset#get-themes-theme-id-assets

 

But I don't know if this will actually work. I guess the template prefix would be part of the key value?

BohdanNikitchuk
Shopify Partner
5 0 1

Hmm, it sounds like a possible solution, must try. Thank you!