Issue with Cart Validation Blocking Product Deletion

Issue with Cart Validation Blocking Product Deletion

Shopify Partner
2 0 0

I am using the cart-checkout-validation API  function to validate the quantity of items in the cart. This function throws error messages if any product has a quantity larger or smaller than the specified limits.


The issue arises when a user adds products to the cart before the merchant sets these limits, and then tries to delete a product after the merchant specifies a lower quantity limit for that product. In this case, the product cannot be deleted due to the error messages triggered by other products in the cart.


Has anyone encountered this issue before? Is there a solution for this? Alternatively, does anyone know how to identify whether the cart-checkout-validation API function is being invoked specifically due to the deletion or quantity adjustment of products? Any advice or suggestions would be greatly appreciated.


Screenshot 2024-06-26 141027.png

Reply 1 (1)

Shopify Partner
6 0 1

Having the same issue as well. Seems to be a race condition. From what I can tell the validation is running before the update quantity function can run, and throws the error along with the quantity reset, so the update quantity function doesn't really get a chance to run. Overall this should be a pretty rare edge case as long as the metafield is set, but it can still happen if the merchant is updating the quantity limits frequently etc.