Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Shopify Function Validation Failing After Logout Due to Cart Re-add Issue

Shopify Function Validation Failing After Logout Due to Cart Re-add Issue

JackLin_PG
Shopify Partner
8 0 1

I'm facing an issue with a Shopify function we're using for cart and checkout validation, which checks if a customer has a specific tag before allowing them to purchase certain products. The problem arises when a customer logs out: Shopify automatically removes the items from the cart and then re-adds them after the logout process is complete. Since the customer is now logged out, they no longer have the necessary tag, causing the validation to fail during this re-add process and preventing the logout from completing successfully.

My questions are:

  1. Has anyone else encountered a similar issue with cart re-add after logout causing validation failures?
  2. Is there a way to identify in the Shopify function for cart and checkout validation whether the input is coming from this automatic re-add triggered by logout? If I can identify these re-adds, I could bypass them to ensure the logout function works as expected.

For more details, I've attached a screen recording of the issue: Video Link.

Any advice or suggestions would be greatly appreciated!

Thanks!

Replies 0 (0)