From dc4cc754dea2883de90b4b109c7bdf186405ea83 Mon Sep 17 00:00:00 2001 From: Kevin Gorjan Date: Mon, 24 Jan 2022 13:19:33 +0100 Subject: [PATCH 1/2] fix(composables): re-calculate cart when changing shipping-method --- .../theme/components/Checkout/VsfShippingProvider.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/theme/components/Checkout/VsfShippingProvider.vue b/packages/theme/components/Checkout/VsfShippingProvider.vue index 67ed99527..7ae13e49a 100644 --- a/packages/theme/components/Checkout/VsfShippingProvider.vue +++ b/packages/theme/components/Checkout/VsfShippingProvider.vue @@ -112,6 +112,7 @@ export default defineComponent({ const { cart } = useCart(); const { state, + save: saveShippingProvider, error: errorShippingProvider, loading: loadingShippingProvider, setState, @@ -129,9 +130,14 @@ export default defineComponent({ * Instead, specify the pickup_location_code attribute in the setShippingAddressesOnCart mutation. */ const selectShippingMethod = async (method) => { - await setState({ + const shippingData = { carrier_code: method.carrier_code, method_code: method.method_code, + }; + + setState(shippingData); + await saveShippingProvider({ + shippingMethod: shippingData, }); }; From 623ca03a29b34f2aa6ff92d3aa27344d8087ab3d Mon Sep 17 00:00:00 2001 From: Kevin Gorjan Date: Tue, 25 Jan 2022 13:10:46 +0100 Subject: [PATCH 2/2] fix(theme): removed cache-id for retrieving shipping methods Cache id is removed because it retrieves the cached shipping methods. But when the address changes, it can be that the price of shipping methods need to be updated --- packages/theme/components/Checkout/VsfShippingProvider.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/theme/components/Checkout/VsfShippingProvider.vue b/packages/theme/components/Checkout/VsfShippingProvider.vue index 7ae13e49a..e1295d2fe 100644 --- a/packages/theme/components/Checkout/VsfShippingProvider.vue +++ b/packages/theme/components/Checkout/VsfShippingProvider.vue @@ -108,7 +108,7 @@ export default defineComponent({ result: shippingMethods, loading: loadingShippingMethods, error: errorUseGetShippingMethods, - } = useGetShippingMethods('VsfShippingProvider'); + } = useGetShippingMethods(); const { cart } = useCart(); const { state,