Creates a new product by copying an existing product. Give the source product’s code and the code, name and SKU for the new product. The response returns the new product record.
Note
By default all product data is copied unless a custom copy product rule is applied.
Before you begin#
- The API token needs
Product_Copy, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the code of the product to copy (
Source_Product_Code).
Example requests#
Copy a product#
Copies the product shirt to a new product with the code shirt_2.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Product_Copy",
"Source_Product_Code": "shirt",
"Dest_Product_Code": "shirt_2",
"Dest_Product_Name": "Shirt 2",
"Dest_Product_SKU": ""
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Store_Code |
String | Yes | The store to run the function against |
Function |
String | Yes | Product_Copy |
Miva_Request_Timestamp |
Number | Unix time the request was made. See Authentication and security. | |
Source_Product_Code |
String | Code of the product to copy | |
Dest_Product_Code |
String | Yes | Code for the new product |
Dest_Product_Name |
String | Yes | Name for the new product |
Dest_Product_SKU |
String | No | SKU for the new product |
Example response#
{
"success": 1,
"completed": true,
"data": {
"id": 3,
"disp_order": 3,
"code": "shirt_2",
"sku": "",
"name": "Shirt 2",
"thumbnail": "",
"image": "",
"price": 10.0,
"formatted_price": "$10.00",
"cost": 0.0,
"formatted_cost": "$0.00",
"descrip": "",
"weight": 0.0,
"taxable": true,
"active": true,
"page_title": "",
"dt_created": 1677174851,
"dt_Updated": 1677174851
}
}
Response parameters#
data holds the new product. Most of its fields are the product fields described in ProductList_Load_Query.
Related functions#
| Function | Use it to |
|---|---|
Product_Insert |
Create a product from scratch |
Product_Update |
Change a product |
Product_Delete |
Delete a product |
ProductList_Load_Query |
Find products |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > Product_Copy. See Set Up Postman.