#Medusa-fulfillment-shippo

3 messages · Page 1 of 1 (latest)

snow shoal
#

Hello, guys. Who can help me with shippo plugin? I can pay if needed

I have added some shipping options from shippo to Medusa, and I show them on UI

Options with flat rate works good
But I am not able to select option with live rate

I have made some debugging and I see that in case when I select flat rate I send cart with full variant object, but in case of live rate I send cart with variant ids, not the full variant object.

What is the difference if code is the same. I have no understanding how and what should I fix in plugin or Medusa…
Could you help?

modern cove
#

hi @snow shoal - what do you mean by you cannot select live rate? Is it something not working on Admin side or on your Storefront side? What exact error you see?

snow shoal
# modern cove hi <@330031031451385867> - what do you mean by you cannot select live rate? Is ...

Context:
We are trying to connect Shippo to our backend built on Medusa. We connected Shippo via the medusa-fulfillment-shippo plugin. We created some rates at checkout options on Shippo. Then we created some shipment options on Medusa and set the fulfillment provider to the shipment option from Shippo. It works well if we set a flat_rate on Shippo. However, if we set a live_rate on Shippo, we encounter an error on our frontend. We are not able to set that option via medusaClient.carts.addShippingMethod.
After some debugging, we noticed that the error is thrown here: https://github.com/macder/medusa-fulfillment-shippo/blob/main/src/utils/formatters.js#L14
When we try to provide the ID of a shipping option that has a flat_rate type, we encounter no errors and everything works fine. However, when we try to provide the ID of a shipping option that has a calculated price type, we encounter an error.
The issue is likely (but not certain) due to the packCart function.
In the first case (when everything works fine), we have the whole cart object in the cartOrId variable. In the second case (when we encounter the error), we only have the cart ID in that variable. After retrieving it, cart.items has no variant, which is required for the productLineItem function, only variant_id, which is not needed at all.
Expected result:
To be able to choose any shipping option and to calculate the live rate at the moment when shipping options render.

GitHub

Shippo fulfillment provider for Medusa. Contribute to macder/medusa-fulfillment-shippo development by creating an account on GitHub.