Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Could not pass currency value via checkout api

Could not pass currency value via checkout api

aruninnoppl
Tourist
12 0 2

Hello,

 

I'm using checkout api to create a checkout in Shopify and get the web_url from the response. It is working fine and I can see the product added to the checkout when I access the web_url.

Here is the data I send to Shopify via checkout api.


$postData_1 = array ('checkout' => array ('email' => $email, 'line_items' => [array ('variant_id' => 30872868290611, 'quantity' => 1 )], 'note_attributes' => array ('referrer_url' => $shop_current_url, 'redirect_url' => $shop_redirect_url, 'customer_location' => $customer_location ), 'shipping_address' => array ('first_name' => $fname, 'last_name' => $lname, 'address1' => $address1, 'city' => $city, 'country_code' => $country, 'phone' => $phone, 'zip' => $zip, ), ), );

$postData = json_encode($postData_1);

 

It is working fine. Along with this, I'm trying to pass the currency (USD or CAD or GBP) to Shopify but it always chooses USD and not the one I sent.

 

I'm able to change the currency when I add the product from my Shopify store but not working when I send the product info via api.

 

Here are the codes I tried so far.

1) $postData_1 = array ('checkout' => array ('email' => $email, 'line_items' => [array ('variant_id' => 30872868290611, 'currency'=>'GBP', 'quantity' => 1 )], 'note_attributes' => array ('referrer_url' => $shop_current_url, 'redirect_url' => $shop_redirect_url, 'customer_location' => $customer_location ), 'shipping_address' => array ('first_name' => $fname, 'last_name' => $lname, 'address1' => $address1, 'city' => $city, 'country_code' => $country, 'phone' => $phone, 'zip' => $zip, ), ), );

2) $postData_1 = array ('currency'=>'GBP', 'checkout' => array ('email' => $email, 'line_items' => [array ('variant_id' => 30872868290611, 'quantity' => 1 )], 'note_attributes' => array ('referrer_url' => $shop_current_url, 'redirect_url' => $shop_redirect_url, 'customer_location' => $customer_location ), 'shipping_address' => array ('first_name' => $fname, 'last_name' => $lname, 'address1' => $address1, 'city' => $city, 'country_code' => $country, 'phone' => $phone, 'zip' => $zip, ), ), );

 

But none of them have worked. It always chooses USD. I also checked the solution on the community and found a few other guys posted the same question but no solution so far.

 

Can anyone help me with this?

 

Thanks in advance.

 

-Arun

Replies 2 (2)

SBD_
Shopify Staff
1831 273 423

Hey @aruninnoppl,

 

I'm able to replicate. This is a bug on our end. A fix is in the works. Keep an eye on this thread.

 

Side note: currency is read-only, once this is fixed you'll want to use presentment_currency.

Scott | Developer Advocate @ Shopify 

aruninnoppl
Tourist
12 0 2

Hi @SBD_,

 

Thanks for your reply and I'll wait for your answer. 

 

It would be very helpful if it is fixed sooner.

 

Thanks & regards,

-Arun