Updates an existing product. All parameters are optional, so send only the fields you want to change, such as the price, inventory count or custom field values. To add to or subtract from inventory instead of setting it, use ProductList_Adjust_Inventory.
Before you begin#
- The API token needs
Product_Update, 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 one of the product’s
Edit_Product,Product_ID,Product_CodeorProduct_SKUvalues to identify it.
Example requests#
Update a product#
Finds the product with code Test through Edit_Product, then changes its code, SKU, pricing, inventory and custom field values.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Product_Update",
"Edit_Product": "Test",
"Product_Code": "new_product_code",
"Product_SKU": "555182",
"Product_Name": "Hello World",
"Product_Description": "ddddd",
"Product_Alternate_Display_Page": "ABUS",
"Product_Page_Title": "eeeee",
"Product_Thumbnail": "graphics/en-US/someimage_thumbnail.jpg",
"Product_Image": "graphics/en-US/someimage.jpg",
"Product_Price": 5.29,
"Product_Cost": 1.27,
"Product_Weight": 3.58,
"Product_Inventory": 26,
"Product_Taxable": true,
"Product_Active": true,
"Product_ExcludeFromSearchResults": true,
"CustomField_Values": {
"cmp-cssui-pchdft": {
"header": "",
"footer": ""
},
"cmp-mv-prodctgy-meta": {
"keywords": "",
"description": ""
},
"discount_saleprice": {
"custom_field_code": 10
},
"upsxml": {
"ups_additional_handling": "No",
"ups_delivery_confirmation": "Default",
"ups_fpackage": "",
"ups_fclass": "",
"ups_fnmfccom": "",
"ups_fnmfcsubcm": "",
"ups_fdanger": "0",
"ups_fdangermod": "0",
"hscode": "",
"origcntry": ""
},
"baskinv": {
"basket_inv": "0",
"total_inv": ""
},
"combofacets": {
"fitment": [],
"second": []
},
"customfields": {
"checkbox_CUSTOMFIELD_CODE": true,
"imageupload_CUSTOMFIELD_CODE": "graphics/en-US/somecustomfieldimage.jpg",
"text_CUSTOMFIELD_CODE": "fffff",
"textarea_CUSTOMFIELD_CODE": "ggggg",
"dropdown_CUSTOMFIELD_CODE": "bbbbb",
"multitext_CUSTOMFIELD_CODE": ["hhhhh", "iiiii"]
},
"marketplaces": {
"googleshopping_item_id": "",
"googleshopping_title": "",
"googleshopping_condition": "",
"googleshopping_availability": "",
"googleshopping_description": "",
"googleshopping_product_category": "",
"googleshopping_item_number": "",
"googleshopping_part_number": "",
"googleshopping_brand": "",
"googleshopping_weight": "",
"googleshopping_sale_price": "",
"googleshopping_product_type": "",
"googleshopping_expiration_date": "",
"googleshopping_color": "",
"googleshopping_material": "",
"googleshopping_pattern": "",
"googleshopping_gender": "",
"googleshopping_age_group": "",
"googleshopping_item_size": "",
"googleshopping_size_type": "",
"googleshopping_size_system": "",
"googleshopping_adwords_redirect_url": "",
"googleshopping_multipack": "",
"googleshopping_is_bundled": "",
"googleshopping_adult_product": "",
"googleshopping_custom_0": "",
"googleshopping_custom_1": "",
"googleshopping_custom_2": "",
"googleshopping_custom_3": "",
"googleshopping_custom_4": "",
"googleshopping_unit_value": "",
"googleshopping_unit": "",
"googleshopping_base_value": "",
"googleshopping_base_unit": "",
"googleshopping_ignore_product": "",
"googleshopping_shipping_label": "",
"googleshopping_gtin": ""
},
"productdigitaldownloadcustomfields": {
"enabled": "No",
"max_dl": "Global",
"expiration": "Global",
"cdn_name": "",
"miva_path": "",
"miva_name": "",
"bucket": "",
"file": "",
"region": ""
},
"productimagecustomfields": {
"main": "graphics/00000001/1/ny__gift-card--main.png",
"back": ""
},
"productdata": {
"data_field_code": "0"
}
}
}
custom_field_code under discount_saleprice is the custom field code set in the Price Group settings.
Update inventory#
Sets the inventory count of the product with SKU 555185 to 50. Every other field stays as it is.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Product_Update",
"Product_SKU": "555185",
"Product_Inventory": 50
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
product_idEdit_ProductProduct_CodeProduct_SKU |
Number String String String |
One of these | ID Number of product Product code string Product code string Product SKU string |
product_code |
String | No | Product Code of the product to update. This is a unique value in Miva. |
product_sku |
String | No | Product SKU of the product to update. If a non-unique value is passed to this parameter, it will generate an “Ambiguous product SKU” error. |
product_name |
String | No | Product Name |
product_description |
String | No | Product Description. Full HTML description allowed. |
product_canonical_category_code |
String | No | The canonical category is used to populate the breadcrumbs and category tree when no category code is present. |
product_alternate_display_page |
String | No | Alternate Page template to use when rendering this product |
product_page_title |
String | No | The Title Tag for this product. |
product_thumbnail |
String | No | Product Thumbnail. This field is deprecated. Images should be uploaded using ProductImage_Add |
product_image |
String | No | Product Fullsize Image. This field is deprecated. Images should be uploaded using ProductImage_Add |
product_price |
Number | No | Product Price. This is the price the product will be purchased at. |
product_cost |
Number | No | Product Cost. Used for reporting and certain types of discounts (markup from cost) |
product_weight |
Number | No | Product Weight |
product_Inventory |
Number | No | Current inventory count available for the product. Updating this value does not take into account stock held in open baskets |
product_taxable |
Boolean | No | true or false value depending on if a product is taxable. |
product_active |
Boolean | No | true or false value depending on if a product is active |
product_excludefromsearchresults |
Boolean | No | When true, excludes the product from on-site search results. Added in Miva 26.01.01. |
customfield_values |
Object | An object containing customfield object(s) with custom product fields to update. See example below. |
customfield_values#
An object containing customfield object(s) with custom product fields to update. The object within customfield_values will contain the module_code followed by the custom_field_code or custom_field_id:
"CustomField_Values":{
"<module code>":{
"<field code>": UPDATED_VALUE
}
}
Example response#
{
"success": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
boolean | boolean value for if the request was successful |
Error responses#
Example error response#
{
"success": 0,
"error_code": "MER-JSN-00018",
"error_message": "Invalid value for field 'Product_Canonical_Category_Code': Category 'aaaaa' not found",
"validation_error": true,
"error_field": "Product_Canonical_Category_Code",
"error_field_message": "Category 'aaaaa' not found"
}
Error codes#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-JSN-PRD-00013 | Product not found | Product Code sent in Edit_Product field does not exist. |
| MER-JSN-PRD-00014 | Product not found | Product Code sent in Product_Code does not exist. |
| #Error# | Unable to load product | One of Edit_Product, Product_ID, Product_Code, or Product_SKU must be specified. |
| MER-JSN-PRD-00072 | Ambiguous product SKU | Two or more products share the same product SKU. |
Related functions#
| Function | Use it to |
|---|---|
Product_Insert |
Create a product |
Product_Delete |
Delete a product |
ProductList_Adjust_Inventory |
Add to or subtract from inventory counts |
ProductList_Load_Query |
Find products and their IDs, codes and SKUs |
ProductImage_Add |
Add an image to a product |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > Product_Update. See Set Up Postman.