Skip to content

Commit

Permalink
fix: product stock is not reducing while order is placed via rest api (
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Apr 17, 2019
1 parent 1422260 commit 4efac87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/class-order-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ public function ensure_vendor_coupon( $valid, $coupon ) {
* @return void
*/
public function restore_reduced_order_stock( $order ) {
// seems in rest request, there is no such issue like (stock reduced by twice), so return early
if ( defined( 'REST_REQUEST' ) ) {
return;
}

$has_sub_order = wp_get_post_parent_id( $order->get_id() );

// seems it's not a parent order so return early
Expand Down

0 comments on commit 4efac87

Please sign in to comment.