Re: Incorrect item price syncing on Shopify through Shopify api

Incorrect item price syncing on Shopify through Shopify api

Webgility1
Shopify Partner
58 1 9

Hello Shopify 

We are integrating Shopify with Shopify REST Apis. 

When we are synchronizing the products price with 3 decimal places then Incorrect item price is synchronized on Shopify. While its working fine with 1 and 2 decimal places price? 

We are using following API

Request URLhttps://mewebg.myshopify.com/admin/api/2021-01/variants/19795498860606.json

Request headers :
X-Shopify-Access-Token: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
Content-Type:application/json

Request Body :
{
"variant": {
"id": 19795498860606,
"price": "16.843"
}
}

Response :
{
"variant": {
"id": 19795498860606,
"product_id": 2164582219838,
"title": "#!43_a",
"price": "16843.00",
"sku": "#!43_a",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": "20.00",
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "#!43_a",
"option2": null,
"option3": null,
"created_at": "2019-05-21T06:26:24-04:00",
"updated_at": "2021-05-08T10:26:08-04:00",
"taxable": false,
"barcode": null,
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "lb",
"inventory_item_id": 20479142658110,
"inventory_quantity": 5,
"old_inventory_quantity": 5,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/19795498860606"
}
}

Please let us know why correct price (eg 16.843) is not synchronized? 

Replies 4 (4)

Webgility1
Shopify Partner
58 1 9

Hello Shopify,

 

Is there any update on this issue?

 

Webgility

Webgility1
Shopify Partner
58 1 9

Hello Shopify is there any update on this issue?

GrahamS
Shopify Staff (Retired)
193 37 55

Hello @Webgility1 ,

This would be an expected outcome when syncing products to a shop that is configured to use a currency that maxes out at 2 decimal places. If you attempt to sync an item to a shop with an incompatible currency, it will automatically be rounded during import. Only a few currencies are capable of accepting 3 decimal places.

I would check to see what currency the affected shop is using (via settings>general), and reference it against the list available HERE to see the maximum allowable decimals.

Best,

To learn more visit the Shopify Help Center or the Community Blog.

Webgility1
Shopify Partner
58 1 9

Hi ,

The solution which you provided does not relates to our question. Our issue is not of rounding of decimals. Real problem is that incorrect price is syncing.

In request : we are sending ->  "price": "16.843"

In response : we are getting ->  "price": "16843.00"

It is removing decimals. And this is happening when we are sending more than 2 decimal places in price.
Even if its a currency issue then it should have rounded of till 2 decimal places and should have response as  "price": "16.84"(omitting 3rd digit)

But it works perfectly fine when we provide price with 2 decimal places as below

In request : we are sending ->  "price": "16.84"

In response : we are getting ->  "price": "16.84"

Please look into this issue.

Thanks

Webgility