From f92730544305364054f885736545ea3099683b1d Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 13 Jun 2019 15:33:56 +0100 Subject: [PATCH] set_backorders --- src/Controllers/Version4/Products.php | 4 ++-- unit-tests/Tests/Version4/Products.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controllers/Version4/Products.php b/src/Controllers/Version4/Products.php index c137842b1f9..536d9d5a5d2 100644 --- a/src/Controllers/Version4/Products.php +++ b/src/Controllers/Version4/Products.php @@ -423,12 +423,12 @@ class Products extends AbstractObjectsController { if ( $product->is_type( 'grouped' ) ) { $product->set_manage_stock( false ); - $product->set_backorders( false ); + $product->set_backorders( 'no' ); $product->set_stock_quantity( '' ); $product->set_stock_status( $stock_status ); } elseif ( $product->is_type( 'external' ) ) { $product->set_manage_stock( false ); - $product->set_backorders( false ); + $product->set_backorders( 'no' ); $product->set_stock_quantity( '' ); $product->set_stock_status( 'instock' ); } elseif ( $product->get_manage_stock() ) { diff --git a/unit-tests/Tests/Version4/Products.php b/unit-tests/Tests/Version4/Products.php index 94585a06e97..744674c8a8c 100644 --- a/unit-tests/Tests/Version4/Products.php +++ b/unit-tests/Tests/Version4/Products.php @@ -281,7 +281,7 @@ class Products extends WC_REST_Unit_Test_Case { ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); - +var_dump($data); $this->assertEquals( 'Test API Update', $data['button_text'] ); $this->assertEquals( 'http://automattic.com', $data['external_url'] ); }