shipping rate error while displaying at checkout

laiji
New Member
12 0 0

Hi,
I am creating a custom shipping method via carrier Service API. I am able to register a new carrier service and the new shipping method is displaying in the frontend. But the issue is the rate which I specified in the callback URL and the one which is displaying in checkout is different. There is an issue of decimal values in the frontend display.
in the callback URL my shipping rate is 100 USD. my store currency is DHS. what it is displaying in checkout page is 3.67 DHS instead of 367 DHS. I am not sure where the conversion occur and Can anyone help me to fix this issue.

 

Thanks

0 Likes
_JCC_
Shopify Staff
Shopify Staff
64 8 9

Hi @laiji,

When constructing the total_price for your rate response are you returning 100 or 10000 for total_price? Your rate response is rendered in checkout using a  money filter.

As an example a North American order with a returned  total_price of "100" would be rendered in liquid with {{ "100" | money }} and display as $1.00.

If in your example of 100 USD you are returning "total_price":"10000" please perform a request that returns 100.00 dollars USD, and DM me your carrier service id. I would be happy to investigate this further by reviewing our logs.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

laiji
New Member
12 0 0

@_JCC_  Thank you so much for the support. It worked. I am able to get the right shipping rate on the frontend. Also I missed to add  weights for my products . That caused the trouble.
It is fixed and working fine now.

0 Likes
laiji
New Member
12 0 0

Hi,
I am facing a new issue in the rate calculation. I am able to calculate and display the same rate on checkout. But I have to calculate the rate based on weight unit.
I am now taking the store(all) weight unit as kg and calculating my rate based on kg. But how can I do the conversion if a merchant use a different  weight unit like lb .
How can I  get the weight unit a  merchant using in his store.
Using shop API will get the default weight unit. But I am unable to  access shop api in this page .Because my stored access token is not getting on the call back page.
 

Any of the following will help to resolve the issue.

1.How can I get the weight unit a merchant using in his store?

2.How can I access shop API in the call back page?

3.How can I access the access token which is stored in database, Since for accessing the token I have to pass the shop URL which I don't have in this page.

 

Can anyone please assist on it.

 

Thanks

0 Likes