Skip to content

Commit 10735d9

Browse files
authored
Merge pull request #10 from PolyPlugins/version/1.0.10
1.0.10
2 parents 37352b2 + 560cb36 commit 10735d9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

README.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Yes, the plugin supports uploading images to the WordPress media library via the
6565

6666
## Changelog
6767

68+
### 1.0.10
69+
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint to not require quantity
70+
6871
### 1.0.9
6972
* Added: [Get All Product IDs](https://www.polyplugins.com/docs/content-api/api/get-all-product-ids/) endpoint
7073
* Added: Attribute manage_stock to results of [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) endpoint

content-api.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Content API
55
* Plugin URI: https://www.polyplugins.com/contact/
66
* Description: Adds various endpoints to create content
7-
* Version: 1.0.9
7+
* Version: 1.0.10
88
* Requires at least: 6.5
99
* Requires PHP: 7.4
1010
* Author: Poly Plugins
@@ -544,6 +544,7 @@ public function update_product(WP_REST_Request $request) {
544544
$weight = isset($fields['weight']) ? floatval($fields['weight']) : '';
545545
$stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
546546
$manage_stock = isset($fields['manage_stock']) ? sanitize_text_field($fields['manage_stock']) : '';
547+
$stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : false;
547548
$tags = isset($fields['tags']) && is_array($fields['tags']) ? array_map('sanitize_text_field', $fields['tags']) : array();
548549
$categories = isset($fields['categories']) && is_array($fields['categories']) ? array_map('sanitize_text_field', $fields['categories']) : array();
549550
$featured_image = isset($fields['featured_image']) ? sanitize_url($fields['featured_image']) : '';
@@ -582,8 +583,6 @@ public function update_product(WP_REST_Request $request) {
582583
if (!isset($product) || !$product) {
583584
return new WP_Error('product_not_found', 'Product not found', array('status' => 404));
584585
}
585-
586-
$stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : false;
587586

588587
if ($slug) {
589588
// Check if slug is empty after sanitization
@@ -775,7 +774,7 @@ public function create_product(WP_REST_Request $request) {
775774
$weight = isset($fields['weight']) ? floatval($fields['weight']) : '';
776775
$stock_status = isset($fields['stock_status']) ? sanitize_text_field($fields['stock_status']) : '';
777776
$manage_stock = isset($fields['manage_stock']) ? sanitize_text_field($fields['manage_stock']) : '';
778-
$stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : '';
777+
$stock_quantity = isset($fields['stock_quantity']) ? intval($fields['stock_quantity']) : false;
779778
$tags = isset($fields['tags']) && is_array($fields['tags']) ? array_map('sanitize_text_field', $fields['tags']) : array();
780779
$categories = isset($fields['categories']) && is_array($fields['categories']) ? array_map('sanitize_text_field', $fields['categories']) : array();
781780
$featured_image = isset($fields['featured_image']) ? sanitize_url($fields['featured_image']) : '';

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: polyplugins
33
Tags: content api, rest api, content, creative, api
44
Tested up to: 6.8
5-
Stable tag: 1.0.9
5+
Stable tag: 1.0.10
66
Requires PHP: 7.4
77
License: GPLv3
88
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -84,6 +84,9 @@ Yes, the plugin supports uploading images to the WordPress media library via the
8484

8585
== Changelog ==
8686

87+
= 1.0.10 =
88+
* Updated: [Create Product](https://www.polyplugins.com/docs/content-api/api/create-product/) endpoint to not require quantity
89+
8790
= 1.0.9 =
8891
* Added: [Get All Product IDs](https://www.polyplugins.com/docs/content-api/api/get-all-product-ids/) endpoint
8992
* Added: Attribute manage_stock to results of [Get Product](https://www.polyplugins.com/docs/content-api/api/get-product/) endpoint

0 commit comments

Comments
 (0)