Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping rate is not updating when signed in #889

Open
fareedkamal opened this issue Aug 30, 2024 · 0 comments
Open

Shipping rate is not updating when signed in #889

fareedkamal opened this issue Aug 30, 2024 · 0 comments
Milestone

Comments

@fareedkamal
Copy link

fareedkamal commented Aug 30, 2024

I'm using codebase from woonext app pro. i'm encountering an issue where the shipping rate doesn't update while signed in but it works as guest.

On my woocommerce store i have shipping rates saved. for US its 8$ and some label and other info. for rest of world its 20$
after updateCart i get the response cart object with correct shipping rate and total when im as guest. when im signed as a registered user and change country, the shipping rate is fixed to 8$

here's the logic that i've implemented for updating shipping rate.

in my checkout form , if the country is changed the below function is triggered

const { setShippingLocale } = useOtherCartMutations(sessionContext);
const { cart: cartData, updateCart } = useSession();

const updateShippingRate = async () => {
try {

  await setShippingLocale({
    country: formik.values.billing.country,
    city: formik.values.billing.city,
    state: formik.values.billing.state,
    postcode: formik.values.billing.postcode,
  });

  await updateCart({
    mutation: 'updateItemQuantities',
    input: {
      items: [
        {
          key: cart?.contents?.nodes[0].key as string,
          quantity: cart?.contents?.nodes[0].quantity as number,
        },
      ],
    },
  });

} catch (error) {
  console.log(error);
}

};

u can reference the sessionOperations.tsx file and the app/api/cart/route.ts file from woonext app pro

packages used are:
"@woographql/next": "^1.4.9",
"@woographql/react-hooks": "^0.9.3",
"@woographql/session-utils": "^1.5.3",

Plugin Versions

  • WooGraphQL Pro 1.2.0
  • WPGraphQL 1.27.0
  • WPGraphQL WooCommerce (WooGraphQL) 0.19.0
  • WPGraphQL JWT Authentication 0.7.0

is this a woocommerce internal issue or woographql plugin issue?

@kidunot89 kidunot89 added this to the v0.21.1 milestone Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants