Check store api draft order on short code for reserved stock (#42796)

This commit is contained in:
Brian Borman 2023-12-20 09:18:47 -05:00 committed by GitHub
parent 95c34a430d
commit df1f5d9e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Shortcode cart checks for Store API reserved stock

View File

@ -759,7 +759,7 @@ class WC_Cart extends WC_Legacy_Cart {
public function check_cart_item_stock() {
$error = new WP_Error();
$product_qty_in_cart = $this->get_cart_item_quantities();
$current_session_order_id = isset( WC()->session->order_awaiting_payment ) ? absint( WC()->session->order_awaiting_payment ) : 0;
$current_session_order_id = isset( WC()->session->order_awaiting_payment ) ? absint( WC()->session->order_awaiting_payment ) : absint( WC()->session->get( 'store_api_draft_order', 0 ) );
foreach ( $this->get_cart() as $values ) {
$product = $values['data'];