Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Update reserved stock when a row already exists #2747

Merged
merged 1 commit into from Jun 23, 2020
Merged

Update reserved stock when a row already exists #2747

merged 1 commit into from Jun 23, 2020

Conversation

mikejolley
Copy link
Member

When the wc_reserve_stock table is updated and there is a duplicate row, it was only updating the expires column. It needs to also update the stock_quantity so changes to the cart are respected.

Fixes #2746

How to test the changes in this Pull Request:

  1. Add a stock managed product to the cart and go to the Block Checkout, qty 1.
  2. See the wc_reserve_stock table has a row with stock reserved.
  3. Go back to the cart and increase the qty of the item in your cart.
  4. Go back to the Block Checkout.
  5. Confirm the row in wc_reserve_stock now has the new qty.

Changelog

Fix updating the wc_reserve_stock stock_quantity value after making changes to the cart inbetween checkouts.

@mikejolley mikejolley added this to the 2.8.0 milestone Jun 18, 2020
@mikejolley mikejolley requested a review from a team as a code owner June 18, 2020 11:08
@mikejolley mikejolley self-assigned this Jun 18, 2020
@mikejolley mikejolley requested review from nerrad and removed request for a team June 18, 2020 11:08
@mikejolley mikejolley changed the title Update stock when a row already exists Update reserved stock when a row already exists Jun 18, 2020
@mikejolley
Copy link
Member Author

This fix has also been raised in core here woocommerce/woocommerce#26807

@github-actions
Copy link
Contributor

Size Change: 0 B

Total Size: 1.58 MB

ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 7.24 kB 0 B
build/active-filters.js 7.95 kB 0 B
build/all-products-frontend.js 40.6 kB 0 B
build/all-products.js 23.7 kB 0 B
build/all-reviews-legacy.js 9.3 kB 0 B
build/all-reviews.js 9.61 kB 0 B
build/attribute-filter-frontend.js 16.8 kB 0 B
build/attribute-filter.js 11.6 kB 0 B
build/block-error-boundary-legacy.js 775 B 0 B
build/block-error-boundary.js 774 B 0 B
build/blocks-legacy.js 2.92 kB 0 B
build/blocks.js 2.92 kB 0 B
build/cart-frontend.js 63.7 kB 0 B
build/cart.js 33.1 kB 0 B
build/checkout-frontend.js 80.3 kB 0 B
build/checkout.js 38.5 kB 0 B
build/custom-select-control-style-legacy.js 782 B 0 B
build/custom-select-control-style.js 783 B 0 B
build/editor-legacy-rtl.css 12.5 kB 0 B
build/editor-legacy.css 12.5 kB 0 B
build/editor-rtl.css 13.5 kB 0 B
build/editor.css 13.5 kB 0 B
build/featured-category-legacy.js 7.27 kB 0 B
build/featured-category.js 7.6 kB 0 B
build/featured-product-legacy.js 9.51 kB 0 B
build/featured-product.js 9.84 kB 0 B
build/handpicked-products-legacy.js 6.91 kB 0 B
build/handpicked-products.js 7.24 kB 0 B
build/price-filter-frontend.js 14.2 kB 0 B
build/price-filter.js 10.1 kB 0 B
build/product-best-sellers-legacy.js 6.99 kB 0 B
build/product-best-sellers.js 7.3 kB 0 B
build/product-categories-legacy.js 3.23 kB 0 B
build/product-categories.js 3.22 kB 0 B
build/product-category-legacy.js 7.91 kB 0 B
build/product-category.js 8.25 kB 0 B
build/product-list-style-legacy.js 774 B 0 B
build/product-new-legacy.js 7.15 kB 0 B
build/product-new.js 7.47 kB 0 B
build/product-on-sale-legacy.js 7.52 kB 0 B
build/product-on-sale.js 7.87 kB 0 B
build/product-search-legacy.js 3.14 kB 0 B
build/product-search.js 3.43 kB 0 B
build/product-tag-legacy.js 6.08 kB 0 B
build/product-tag.js 6.39 kB 0 B
build/product-top-rated-legacy.js 7.12 kB 0 B
build/product-top-rated.js 7.45 kB 0 B
build/products-by-attribute-legacy.js 7.88 kB 0 B
build/products-by-attribute.js 8.19 kB 0 B
build/reviews-by-category-legacy.js 11.3 kB 0 B
build/reviews-by-category.js 11.7 kB 0 B
build/reviews-by-product-legacy.js 12.8 kB 0 B
build/reviews-by-product.js 13.1 kB 0 B
build/reviews-frontend-legacy.js 8.16 kB 0 B
build/reviews-frontend.js 9.01 kB 0 B
build/single-product-frontend.js 43.5 kB 0 B
build/single-product.js 17.4 kB 0 B
build/snackbar-notice-style-legacy.js 778 B 0 B
build/snackbar-notice-style.js 779 B 0 B
build/spinner-style-legacy.js 772 B 0 B
build/spinner-style.js 772 B 0 B
build/style-legacy-rtl.css 5.55 kB 0 B
build/style-legacy.css 5.55 kB 0 B
build/style-rtl.css 17.9 kB 0 B
build/style.css 17.9 kB 0 B
build/vendors-legacy.js 366 kB 0 B
build/vendors-style-legacy-rtl.css 1.03 kB 0 B
build/vendors-style-legacy.css 1.03 kB 0 B
build/vendors-style-legacy.js 103 B 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors-style.js 102 B 0 B
build/vendors.js 414 kB 0 B
build/wc-blocks-data.js 7.09 kB 0 B
build/wc-blocks-middleware.js 932 B 0 B
build/wc-blocks-registry.js 2.19 kB 0 B
build/wc-payment-method-cheque.js 794 B 0 B
build/wc-payment-method-paypal.js 830 B 0 B
build/wc-payment-method-stripe.js 11.9 kB 0 B
build/wc-settings.js 2.14 kB 0 B
build/wc-shared-context.js 1.51 kB 0 B

compressed-size-action

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reserved stock quantity not updating in DB
3 participants