App reviews, troubleshooting, and recommendations
Hi,
the problem occurred when creating validation in shopify functions when logging into the user account (via New Customer Account). In one case the quantity value we get is a value before cart update and in another case the quantity value is after cart update. Steps to reproduce:
As you can see it’s not consistent and it does not allow us to implement our logic because we can not know which value before or update update will be returned to our function
Example:
in fragment
if (minCartQty !== null && quantity > minCartQty) { message = `Minimum quantity is ${minCartQty}. New quantity is ${quantity}`;
if the product in the cart has 4 quantities, and the minimum is 4, when I try to reduce the quantity to 3 I get the message
"Minimum quantity is 4. New quantity is 3.
Which is correct. However, when we want to add a quantity check immediately after loading the page and add above the const erros, something like this
return {
errors: [{
localizedMessage: `Quantity is ${input.cart.lines[0].quantity},
target: "$.cart",
}];
};
so in the same case as above sometimes we get "Quantity is 3" and sometimes "Quantity is 4"
We noticed the incorrectly communicated quantity mainly after logging into the account. That is:
the user who is not logged in receives Quantity is 3, which is correct (because the new qty will be 3)
but when we already have the product in the cart and we log into the account, suddenly there is Quantity is 4 (i.e. it gives not the quantity that should be there, just what is currently in the cart)
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025