#xqprtzcv-shipping-change

1 messages · Page 1 of 1 (latest)

vagrant sirenBOT
glacial sapphire
#

HI 👋

Which doc are you following here?

green estuary
#

I am looking at the stripe js docs

#

I don't see a way to update the shipping option using javascript (like to change from free to express)

glacial sapphire
green estuary
#

Yes, everything is working correctly except the above scenario I described.

glacial sapphire
#

So you are saying you do not see the shippingoptionchange event firing?

green estuary
#

Yeah, that is correct

#

A potential problem is that when I am changing the shipping options in step 2 I am using the same id's that I had before. I am testing to see if I update the ids if that fixes the problem

#

Still seems a little hacky though

#

And I should mention that I see it fire the first time, but not the second time

glacial sapphire
#

When you say you see it fire the first time and not the second time, do you mean the shippingoptionchange event first the first time you choose a shipping option?

green estuary
#

Yes, it fires in step 2, but not in step 4.

#

Before I was using objects like this for the shipping options:
{
"id": "fast",
"label": "Express (2-3 days)",
"detail": "Estimated Delivery 11/13 - 11/14",
"amount": 2087
}

and I changed it to append a time stamp to the id so now the id looks like this: 1699571970fast, and I believe it is working correclty now

#

So I guess when you update the shipping options, it is good to use new ids, otherwise you will run into the problem I was facing.

glacial sapphire
#
  1. I suspect that is why the reference doc shows id: "someUniqueID", but that still isn't very useful
#
  1. That should be better documented if that is the intended use case
green estuary
#

Yeah, and it still seems weird that I can get in a state where the displayed shipping is different than the selected shipping.

#

Like when you run this:
let updateDetails={
"status": 'success',
"shippingOptions":shippingOptionsArr
}
updateWith(updateDetails);

I believe it shows the first option from shippingOptionsArr as being chosen, even when the internal choice is different.

glacial sapphire
#

xqprtzcv-shipping-change

vagrant sirenBOT
green estuary
#

Yes, it appears as the default option, but I believe the saved state is different which is causing the event not to fire.

glacial summit
#

Hello! Jumping in and wondering if there are any outstanding questions or issues? It sounds like you got it working?

green estuary
#

Yes, I got it working, but might be worth you guys having a closer look at it.

glacial summit
#

Will do, thanks for the feedback!