For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello everyone!
I'd like to update cart attributes when user clicks the "complete order" button.
So I call the useApplyAttributeChange func (https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/attributes/useapplyattribute...) inside the useBuyerJourneyIntercept.
I think it processes the payment and redirect to the thank you page after receiving the result from the updateAttribute, but it doesn't work out as I expected and still remains in the payment page.
I want to know the reason. Could anyone explain it to me please?
const updateAttribute = useApplyAttributeChange();
const isRunning = useRef<boolean>(false);
useBuyerJourneyIntercept(async ({ canBlockProgress }) => { if (isRunning.current && canBlockProgress) { return { behavior: "block", reason: "Enter your password", }; } isRunning.current = true; const result = await updateAttribute({ type: "updateAttribute", key: "key", value: "value", }); isRunning.current = false;
return { behavior: "allow", }; });