From 1c47d7e4490af50e9fccc8bb7c864f6640c67d7d Mon Sep 17 00:00:00 2001 From: Mike Keehnen Date: Mon, 27 Nov 2023 11:19:03 +0100 Subject: [PATCH 1/2] Fix: Assign unlocked cart id --- .../MolliePaymentHandler/MolliePaymentHandler.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.tsx b/packages/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.tsx index 337982ca75..733205fa9f 100644 --- a/packages/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.tsx +++ b/packages/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.tsx @@ -1,5 +1,9 @@ import { useMutation } from '@graphcommerce/graphql' -import { ApolloCartErrorFullPage, useClearCurrentCartId } from '@graphcommerce/magento-cart' +import { + ApolloCartErrorFullPage, + useAssignCurrentCartId, + useClearCurrentCartId, +} from '@graphcommerce/magento-cart' import { PaymentHandlerProps, usePaymentMethodContext, @@ -20,6 +24,7 @@ export function MolliePaymentHandler({ code }: PaymentHandlerProps) { const [lockState] = useCartLockWithToken() const clear = useClearCurrentCartId() + const assignCartId = useAssignCurrentCartId() const isActive = selectedMethod?.code === code || lockState.method === code @@ -55,6 +60,7 @@ export function MolliePaymentHandler({ code }: PaymentHandlerProps) { // eslint-disable-next-line @typescript-eslint/no-floating-promises onSuccess(lockState.order_number ?? '') } else if (returnedCartId) { + assignCartId(returnedCartId) // eslint-disable-next-line @typescript-eslint/no-floating-promises router.replace('/checkout/payment') } From 3bd80b88351963ae95aaa97b2cfa25f8e526a128 Mon Sep 17 00:00:00 2001 From: Mike Keehnen Date: Mon, 27 Nov 2023 11:20:41 +0100 Subject: [PATCH 2/2] changeset --- .changeset/poor-badgers-heal.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/poor-badgers-heal.md diff --git a/.changeset/poor-badgers-heal.md b/.changeset/poor-badgers-heal.md new file mode 100644 index 0000000000..f0bbb88d64 --- /dev/null +++ b/.changeset/poor-badgers-heal.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/mollie-magento-payment': patch +--- + +Fixed the issue where a guest returned to a empty cart after a canceled payment with Mollie