-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"Deny when out of stock" behavior improvements 1928 #2034
Conversation
When follow the instructions in Test 1 I get the following error in the server console:
|
@zenweasel It should work now |
|
||
if (quantity < 1) { | ||
quantity = 1; | ||
} | ||
|
||
if (currentVariant.inventoryPolicy && quantity > currentVariant.inventoryQuantity && storedQuantity < currentVariant.inventoryQuantity) { | ||
Alerts.inline("Your product quantity has been adjusted to the max quantity in stock", "warning", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have a i18n translation.
} | ||
|
||
if (currentVariant.inventoryPolicy && totalQuantity > currentVariant.inventoryQuantity) { | ||
Alerts.inline(`Sorry, cart contains maximum quantity of ${currentVariant.title}. Failed to add to cart.`, "error", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs i18n translation (and the alerts that follow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the message is confusing. How does my cart contain the maximum quantity? We are denying because it's out of stock right? The message should reflect that somehow.
}; | ||
|
||
function composer(props, onData) { | ||
const tagSub = Meteor.subscribe("Tags"); | ||
const cartSub = Meteor.subscribe("Cart", Meteor.sessionId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is Meteor.sessionId
coming from? (sessionId is a Reaction thing..fyi) Also the cart subscription is available, (for better or worse) as Reaction.Subscriptions.Cart
, so you can just say if Reaction.Subscriptions.Cart.ready()
So if my quantity is 10 and I add 8 I get the message "Your quantity has been reduced" that's great. However if I try to add an additional 3 (which I should be able to add two as there is 2 left) it just gives me the "Sorry you have the maximum amount in your cart" message which it shouldn't. I also sort of wish this message was where the add to cart message was as I think people will get overwhelmed reading messages from different parts of the screen at the same time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a few more changes
} | ||
|
||
if (currentVariant.inventoryPolicy && totalQuantity > currentVariant.inventoryQuantity) { | ||
Alerts.inline(`Sorry, cart contains maximum quantity of ${currentVariant.title}. Failed to add to cart.`, "error", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the message is confusing. How does my cart contain the maximum quantity? We are denying because it's out of stock right? The message should reflect that somehow.
…commerce/reaction into joykare-inventory-tracking-1928
@zenweasel @aaronjudd changes made |
@@ -15,6 +15,7 @@ import "./templates/cartPanel/cartPanel.html"; | |||
import "./templates/cartPanel/cartPanel.js"; | |||
|
|||
import "./templates/checkout/addressBook/addressBook.html"; | |||
import "./templates/checkout/addressBook/addressBook.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Browser console error:
Uncaught Error: Cannot find module './templates/checkout/addressBook/addressBook.js'
BlazeLayout warning: unknown template "coreLayout"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pulled this branch again and am not seeing that error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can I say, I've reaction reset
, et al, branch is up-to-date, and I'm pointing at the cause of the error right here... ¯_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, now I do
Resolves #1928
Description Part 1
If I have 5 in stock and I add 10 of something to my cart my quantity is reduced to 5 (which makes sense) but I don't receive any sort of alert that my quantity has been changed and the "Added to Cart" alert shows the original quantity, not the adjusted quantity. This could lead to user confusion. I feel like at one time there was an alert that said "Your quantity has been adjusted".
Test Steps
Description Part 2
If I have 5 in stock and I add 10 to my cart my quantity is reduced to 5. If I add another 20, the total quantity is now 10. So the "Deny when out of stock" is only the affecting the quantity I can add to cart, not the quantity in my cart. So I could have 10 in my cart even though there are only 5 in-stock, which I would think is exactly what "Deny when out of stock" is trying to avoid.
Test Steps