@@ -1495,6 +1495,115 @@ woocommerce.get("products").parsed_response
14951495| ` max_price ` | string | Limit result set to products based on a maximum price. |
14961496| ` stock_status ` | string | Limit result set to products with specified stock status. Options: ` instock ` , ` outofstock ` and ` onbackorder ` . |
14971497
1498+ ## Duplicate product ##
1499+
1500+ This API helps you to duplicate a product.
1501+
1502+ ### HTTP request ###
1503+
1504+ <div class =" api-endpoint " >
1505+ <div class="endpoint-data">
1506+ <i class="label label-post">POST</i>
1507+ <h6>/wp-json/wc/v3/products/<product_id>/duplicate</h6>
1508+ </div>
1509+ </div >
1510+
1511+ ``` shell
1512+ curl https://example.com/wp-json/wc/v3/products/< product_id> /duplicate \
1513+ -u consumer_key:consumer_secret
1514+ ```
1515+
1516+ ``` javascript
1517+ WooCommerce .post (" products/2/duplicate" )
1518+ .then ((response ) => {
1519+ console .log (response .data );
1520+ })
1521+ .catch ((error ) => {
1522+ console .log (error .response .data );
1523+ });
1524+ ```
1525+
1526+ ``` php
1527+ <?php print_r($woocommerce->post('products/2/duplicate')); ?>
1528+ ```
1529+
1530+ ``` python
1531+ print (wcapi.post(" products/2/duplicate" ).json())
1532+ ```
1533+
1534+ ``` ruby
1535+ woocommerce.post(" products/2/duplicate" ).parsed_response
1536+ ```
1537+
1538+ > JSON response example:
1539+
1540+ ``` json
1541+ {
1542+ "id" : 824 ,
1543+ "name" : " Premium Quality (Copy)" ,
1544+ "slug" : " " ,
1545+ "date_created" : {
1546+ "date" : " 2024-05-30 19:16:39.000000" ,
1547+ "timezone_type" : 1 ,
1548+ "timezone" : " +00:00"
1549+ },
1550+ "date_modified" : {
1551+ "date" : " 2024-03-08 15:03:19.000000" ,
1552+ "timezone_type" : 1 ,
1553+ "timezone" : " +00:00"
1554+ },
1555+ "status" : " draft" ,
1556+ "featured" : false ,
1557+ "catalog_visibility" : " visible" ,
1558+ "description" : " " ,
1559+ "short_description" : " " ,
1560+ "sku" : " product-22-1" ,
1561+ "price" : " " ,
1562+ "regular_price" : " " ,
1563+ "sale_price" : " " ,
1564+ "date_on_sale_from" : null ,
1565+ "date_on_sale_to" : null ,
1566+ "total_sales" : 0 ,
1567+ "tax_status" : " taxable" ,
1568+ "tax_class" : " " ,
1569+ "manage_stock" : false ,
1570+ "stock_quantity" : null ,
1571+ "stock_status" : " instock" ,
1572+ "backorders" : " no" ,
1573+ "low_stock_amount" : " " ,
1574+ "sold_individually" : false ,
1575+ "weight" : " " ,
1576+ "length" : " " ,
1577+ "width" : " " ,
1578+ "height" : " " ,
1579+ "upsell_ids" : [],
1580+ "cross_sell_ids" : [],
1581+ "parent_id" : 0 ,
1582+ "reviews_allowed" : true ,
1583+ "purchase_note" : " " ,
1584+ "attributes" : [],
1585+ "default_attributes" : [],
1586+ "menu_order" : 0 ,
1587+ "post_password" : " " ,
1588+ "virtual" : false ,
1589+ "downloadable" : false ,
1590+ "category_ids" : [
1591+ 15
1592+ ],
1593+ "tag_ids" : [],
1594+ "shipping_class_id" : 0 ,
1595+ "downloads" : [],
1596+ "image_id" : " " ,
1597+ "gallery_image_ids" : [],
1598+ "download_limit" : -1 ,
1599+ "download_expiry" : -1 ,
1600+ "rating_counts" : [],
1601+ "average_rating" : " 0" ,
1602+ "review_count" : 0 ,
1603+ "meta_data" : []
1604+ }
1605+ ```
1606+
14981607## Update a product ##
14991608
15001609This API lets you make changes to a product.
0 commit comments