-
Notifications
You must be signed in to change notification settings - Fork 11
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
[2.x] Disable checkout button and add notice if not in stock #627
Conversation
There should be an |
It will work in the next release of magento, right now it doesn't and always returns false: magento/magento2@2a406ec#diff-fdd1cac7f74cd87aececd50e3dee357414ab901e8ceaa27c4c2cf3d529f19e55R50 |
@indykoning, what do you think? |
resources/js/package.js
Outdated
canOrderCartItem(item) { | ||
if ('stock_item' in item.product && 'in_stock' in item.product.stock_item && item.product.stock_item.in_stock !== null) { | ||
return item.product.stock_item.in_stock | ||
} | ||
|
||
return true | ||
}, |
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.
The Cart Store may be a more logical place for this.
We're already adding additional data to items here
core/resources/js/stores/useCart.js
Line 203 in c2a0bd7
value.items = value.items.map((cartItem) => { |
Maybe we could do it in a way to polyfill the currently broken is_available
so once we drop support for Magento versions that do have it in it's broken state we can remove this code without breaking changes to the frontend
…nto feature/cart-not-in-stock
Whenever a product in cart is out of stock, there will be a notice with the product that notifies the user of the product being out of stock. This functionality also disables the "proceed to checkout" button.
V3: #628
Internally there's a story to have some extra frontend added for this.