Shopify API to get product details

Shopify API to get product details

AkanshaJindal04
Shopify Partner
3 0 0

Is there any shopify API which will provide the product details based on product handle, language and currency.
Also it should work with hydrogen apps, also any way to get locale, currency value other than from Shopify object as Shopify object will not be present in hydrogen apps

Replies 2 (2)

PageFly-Amelia
Shopify Partner
579 163 233
This is Amelia from PageFly - Landing Page Builder App

Shopify provides APIs that can help you retrieve product details based on the product handle, language, and currency.
  1. Ajax Product API: You can use the Ajax Product API to get the JSON of a product using the product handle. This API supports locale-aware URLs, which means you can specify the language in the URL. All monetary properties are returned in the customer’s presentment currency1.Example:
    fetch('/en/products/red-rain-coat.js')
      .then(response => response.json())
      .then(product => console.log(product));
  2. GraphQL Admin API: This API allows you to manage translations and retrieve product details in different languages. You can enable different locales and translate product content accordingly2.
  3. Currency Resource: The Currency resource in the Admin API represents the currencies that the merchant has enabled. You can use this to ensure that the product details are returned in the correct currency3.
These APIs should help you get the product details you need based on the product handle, language, and currency.

Hope that my solution works for you.
Best regards,
Amelia | PageFly
 

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 
➜ Weekly updated Shopify tutorials on YouTube 


All features are available from Free plan. Live Chat Support is available 24/7.

AkanshaJindal04
Shopify Partner
3 0 0

Hi Amelia
Actually like this I already tried but when app using hydogren or some other translation library then we dont get shopify object.
Also fetching api like this /locale/<productHandle>.js will not work for all stores as with some stores it will work like this /en-gb/handle.json and with some don't
So is there any shopify storefront grapsql api which accepts handle,language and currency and give response?