we have prices, for products, in different currencies, where are these accessible via REST API

Solved

we have prices, for products, in different currencies, where are these accessible via REST API

happy_shopper
Tourist
7 1 1

we have prices, for products, in different currencies, where are these accessible via REST API

Accepted Solution (1)
happy_shopper
Tourist
7 1 1

This is an accepted solution.

found the solution, it required a magic header in the request
Requires the header 'X-Shopify-Api-Features': 'include-presentment-prices'.

View solution in original post

Replies 10 (10)

garyrgilbert
Shopify Partner
428 41 180

 

Wouldn't that be in the product variant?  

 

 

/admin/api/2022-01/variants/{id}.json

 

product->variant->presentment_prices[]

 

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
happy_shopper
Tourist
7 1 1

This is an accepted solution.

found the solution, it required a magic header in the request
Requires the header 'X-Shopify-Api-Features': 'include-presentment-prices'.

garyrgilbert
Shopify Partner
428 41 180

 

Hi, According to the documentation you don't need to include that header. As I mentioned in my post the presentment prices are automatically returned using the REST API,

 

The linke below even indicates that.

https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#[get]/admin/api/2022-01/product...

 

if you don't specify which presentment currencies you want it should always return all.

 

/admin/api/2022-01/products/632910392/variants.json?presentment_currencies=USD,CAD

 

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
pachocastillosr
Tourist
11 1 4

Hi, what if you don't have presentment prices and you just have 1 price.
Rest api (/admin/api/2023-07/products.json) returns this variant object:

 

{
product_id: 8547966910779,
id: 45891642589499,
title: S,
price: 75000.00,
sku: ,
position: 1,
inventory_policy: deny,
compare_at_price: null,
fulfillment_service: manual,
inventory_management: shopify,
option1: S,
option2: null,
option3: null,
created_at: 2023-07-24T10:35:14-05:00,
updated_at: 2023-07-24T10:35:14-05:00,
taxable: false,
barcode: ,
grams: 1000,
image_id: 42429068542267,
weight: 1,
weight_unit: kg,
inventory_item_id: 47938406547771,
inventory_quantity: 2,
old_inventory_quantity: 2,
requires_shipping: true,
admin_graphql_api_id: gid://shopify/ProductVariant/45891642589499}

 

 How can I get the currency of that price with rest api? 

ProgramerAnel
Tourist
10 0 0

Ever found solution for this ?

garyrgilbert
Shopify Partner
428 41 180

 

If you only have one currency defined then there is no need to define the currency on the variant since by default it will be the shop currency. Which means if you want to get the shop currency get the shop object 

 

admin/shop.json

 

In that object the currency will be defined as well as another property called enbaled_presentment_currencies: []  This will contain an array of all the currencies enabled on the shop. In your case it should only be one and match the "currency" property.

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
ProgramerAnel
Tourist
10 0 0

Hello Gary,

I appreciate you answer and taking time to make it. 

 

Unfortunately this is different situation. I'm getting data from others shop and transferring products to my shop (reseller ) . At this point I also need to monitor changes on price in case my supplier change price. 

 

The issue I'm facing here is from time to time externalshop.com/products.json gets me price in currency $ and sometimes in EUR 

 

Example: https://bartonperreira.com/products.json  are you facing me that this response always should return prices in USD ?

 

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @ProgramerAnel

 

Our guide here on Markets contains some great examples to help you get the proper currencies through the various API's, 

 

- https://shopify.dev/docs/apps/selling-strategies/markets#international-pricing

 

Hope that helps! 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ProgramerAnel
Tourist
10 0 0

Thanks for your answer but as I mentioned already. This is not my shop, this means I don't have api access for it. Im only using public routes such as 

 

domain.com/products.json

domain.com/products/productABC.json

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @ProgramerAnel , thanks for that clarification. If you don't have access to the admin or API, then the prices returned in the public routes will be determined by the context that you access the storefront. For example, if you visit the storefront and the prices are USD, that is what will be returned. If there is a country or currency selector, then it will change when you change that context. 

If you want to get the specific presentment and shop currencies programatically, then you'll need to get API access from the merchant through a custom or public app

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog