diff --git a/source/includes/wp-api-v3/_products.md b/source/includes/wp-api-v3/_products.md index ad6ef11..954b7d7 100644 --- a/source/includes/wp-api-v3/_products.md +++ b/source/includes/wp-api-v3/_products.md @@ -1495,6 +1495,115 @@ woocommerce.get("products").parsed_response | `max_price` | string | Limit result set to products based on a maximum price. | | `stock_status` | string | Limit result set to products with specified stock status. Options: `instock`, `outofstock` and `onbackorder`. | +## Duplicate product ## + +This API helps you to duplicate a product. + +### HTTP request ### + +
+
+ POST +
/wp-json/wc/v3/products/<product_id>/duplicate
+
+
+ +```shell +curl https://example.com/wp-json/wc/v3/products//duplicate \ + -u consumer_key:consumer_secret +``` + +```javascript +WooCommerce.post("products/2/duplicate") + .then((response) => { + console.log(response.data); + }) + .catch((error) => { + console.log(error.response.data); + }); +``` + +```php +post('products/2/duplicate')); ?> +``` + +```python +print(wcapi.post("products/2/duplicate").json()) +``` + +```ruby +woocommerce.post("products/2/duplicate").parsed_response +``` + +> JSON response example: + +```json +{ + "id": 824, + "name": "Premium Quality (Copy)", + "slug": "", + "date_created": { + "date": "2024-05-30 19:16:39.000000", + "timezone_type": 1, + "timezone": "+00:00" + }, + "date_modified": { + "date": "2024-03-08 15:03:19.000000", + "timezone_type": 1, + "timezone": "+00:00" + }, + "status": "draft", + "featured": false, + "catalog_visibility": "visible", + "description": "", + "short_description": "", + "sku": "product-22-1", + "price": "", + "regular_price": "", + "sale_price": "", + "date_on_sale_from": null, + "date_on_sale_to": null, + "total_sales": 0, + "tax_status": "taxable", + "tax_class": "", + "manage_stock": false, + "stock_quantity": null, + "stock_status": "instock", + "backorders": "no", + "low_stock_amount": "", + "sold_individually": false, + "weight": "", + "length": "", + "width": "", + "height": "", + "upsell_ids": [], + "cross_sell_ids": [], + "parent_id": 0, + "reviews_allowed": true, + "purchase_note": "", + "attributes": [], + "default_attributes": [], + "menu_order": 0, + "post_password": "", + "virtual": false, + "downloadable": false, + "category_ids": [ + 15 + ], + "tag_ids": [], + "shipping_class_id": 0, + "downloads": [], + "image_id": "", + "gallery_image_ids": [], + "download_limit": -1, + "download_expiry": -1, + "rating_counts": [], + "average_rating": "0", + "review_count": 0, + "meta_data": [] +} +``` + ## Update a product ## This API lets you make changes to a product.