Discussing Shopify Functions development, deployment, and usage in Shopify apps.
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.
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.