calculateChangeset() isn't calculating shipping of added items - Is it meant to?

I’m developing a post-checkout offer app and, from my understanding of the docs, it seems that calling 'calculateChangeset’ from the 'PostPurchaseRenderApi’ should handle any extra shipping costs that may be required for the customer to pay. It is adding the item cost to the order, adding appropriate tax, but shipping is not being added if its required.

I have tested this by setting up various shipping rates that cover different weight ranges, and and adding an item (in the post-checkout offer) that would cause a bump in the shipping rate being charged.

I am passing in the variant with the ‘add_variant’ type, along with the variantId and quantity, as follows:

const changes = [
    {
      type: "add_variant",
      variantID: variantId,
      quantity: 1,
    }
  ]

I see that there is a ‘add_shipping_line’ type that you are able to add to the changes, but I’m assuming that’s not needed for the shipping to be calculated from the added item?

The docs/example of the post-purchase checkout extension leads me to believe the shipping is automatically calculated with no need to pass in the ‘add_shipping_line’ object in the change set.

Happy to be corrected about my understanding of this.

I have tested this on a freshly installed app (Remix template & following the post purchase guide), on a different store with various shipping rates, and it’s still returning the same result of no updated shipping lines.

Having a similar issue. Does Shopify calculate the shipping or we have to do this manually?

In the doc its a bit unclear if it happens automatically from Shopify’s side or not - https://shopify.dev/docs/apps/build/checkout/product-offers/post-purchase/start-building#compute-shipping-and-taxes-using-calculatechangeset

@Danh11 Were you able to figure this out?

I came to the conclusion that you’ve got to work it out yourself and apply the shipping lines. I’m on my phone so I can’t remember details, but there would be a method of some sort that allows you to add a shipping line. I’m not sure how complicated it is as I haven’t implemented it myself yet.