You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,17 @@ Yes, the plugin supports uploading images to the WordPress media library via the
65
65
66
66
## Changelog
67
67
68
+
### 1.0.11
69
+
* Updated: [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) manage_stock attribute to return a bool
70
+
* Updated: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) manage_stock attribute to be able to use bool
71
+
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) manage_stock attribute to be able to use bool
72
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) attributes attribute not creating product attributes when they don't exist.
73
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) attributes attribute not creating product attributes when they don't exist.
74
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) triggering error sku during slug check
75
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) triggering error sku during slug check
76
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) triggering Exception instead of WP Error when upc attribute is already in use
77
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) triggering Exception instead of WP Error when upc attribute is already in use
78
+
68
79
### 1.0.10
69
80
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint to not require quantity
returnnewWP_Error('product_exception', 'An error occurred when attempting to update UPC. It may be in use, please check your trash.', array('status' => 500));
655
+
}
647
656
}
648
657
649
658
if ($weight) {
@@ -654,9 +663,9 @@ public function update_product(WP_REST_Request $request) {
654
663
$product->set_stock_status($stock_status);
655
664
}
656
665
657
-
if ($manage_stock =='true') {
666
+
if ($manage_stock === true) {
658
667
$product->set_manage_stock(true);
659
-
} elseif ($manage_stock =='false') {
668
+
} elseif ($manage_stock === false) {
660
669
$product->set_manage_stock(false);
661
670
}
662
671
@@ -673,6 +682,18 @@ public function update_product(WP_REST_Request $request) {
@@ -736,7 +757,11 @@ public function update_product(WP_REST_Request $request) {
736
757
}
737
758
738
759
// Save the product
739
-
$product_id = $product->save();
760
+
try {
761
+
$product_id = $product->save();
762
+
} catch (Exception$e) {
763
+
returnnewWP_Error('product_exception', 'Error saving product. This typically happens if you are trying to create a new product with a SKU already in use, please check your trash.', array('status' => 500));
764
+
}
740
765
741
766
if (!$product_id) {
742
767
returnnewWP_Error('update_failed', 'Failed to update product', array('status' => 500));
@@ -773,10 +798,11 @@ public function create_product(WP_REST_Request $request) {
returnnewWP_Error('product_exception', 'An error occurred when attempting to update UPC. It may be in use, please check your trash.', array('status' => 500));
884
+
}
853
885
}
854
886
855
887
if ($weight) {
@@ -860,9 +892,9 @@ public function create_product(WP_REST_Request $request) {
860
892
$product->set_stock_status($stock_status);
861
893
}
862
894
863
-
if ($manage_stock =='true') {
895
+
if ($manage_stock === true) {
864
896
$product->set_manage_stock(true);
865
-
} elseif ($manage_stock =='false') {
897
+
} elseif ($manage_stock === false) {
866
898
$product->set_manage_stock(false);
867
899
}
868
900
@@ -912,7 +944,11 @@ public function create_product(WP_REST_Request $request) {
912
944
}
913
945
914
946
// Save the product
915
-
$product_id = $product->save();
947
+
try {
948
+
$product_id = $product->save();
949
+
} catch (Exception$e) {
950
+
returnnewWP_Error('product_exception', 'Error saving product. This typically happens if you are trying to create a new product with a SKU already in use, please check your trash.', array('status' => 500));
@@ -84,6 +84,17 @@ Yes, the plugin supports uploading images to the WordPress media library via the
84
84
85
85
== Changelog ==
86
86
87
+
= 1.0.11 =
88
+
* Updated: [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) manage_stock attribute to return a bool
89
+
* Updated: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) manage_stock attribute to be able to use bool
90
+
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) manage_stock attribute to be able to use bool
91
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) attributes attribute not creating product attributes when they don't exist.
92
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) attributes attribute not creating product attributes when they don't exist.
93
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) triggering error sku during slug check
94
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) triggering error sku during slug check
95
+
* Bugfix: [Update Product](https://www.polyplugins.com/docs/content-api/api/update-product/) triggering Exception instead of WP Error when upc attribute is already in use
96
+
* Bugfix: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) triggering Exception instead of WP Error when upc attribute is already in use
97
+
87
98
= 1.0.10 =
88
99
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint to not require quantity
0 commit comments