Runtime_WishListItemList_Insert
#
This is a runtime function intended to be called client side to add multiple products to a customer’s wishlist. Because this is a runtime (public) function no API key is required. This function requires customer authentication and allows adding one or more products with their attributes and quantities to a specified wishlist. The function intelligently handles duplicate products by merging quantities and provides partial success handling where valid products are processed even if some fail.
Request Parameters#
Parameter |
Type | Description |
---|---|---|
Session_Type |
String | This will always have a hard-coded value of “runtime.” This tells Miva, no authentication is needed for the API call. |
Session_ID |
String | Passing the Session_ID in the request is required for customer authentication to add items to wishlist. |
Products |
Array | Required. Array of product objects to add to the wishlist |
Wishlist_ID |
Number | ID of the destination wishlist where products will be added (if empty the products will be added to the first available wishlist or a wishlist will be created) |
Products
Object Structure#
Each product in the Products
array should contain:
Parameter |
Type | Required | Description |
---|---|---|---|
Product_Code |
String | Yes | Unique product code identifying the product to add |
Product_ID |
Number | No | Product ID (alternative to Product_Code ) |
Quantity |
Number | Yes | Quantity of the product to add (must be positive integer) |
Attributes |
Array | No | Array of product attribute objects for product variations |
Attributes
Object Structure#
Each attribute in the Attributes
array should contain:
Parameter |
Type | Required | Description |
---|---|---|---|
code |
String | No | Attribute code |
template_code |
String | No | Template code for the attribute |
value |
String | No | Selected value for the attribute |
Response Parameters#
Parameter |
Type | Description |
---|---|---|
wishlistitems |
Array of WishListItem Objects | Array of successfully added wishlist items |
wishlistitems
Object#
Parameter |
Type | Description |
---|---|---|
id |
Number | Wishlist item ID |
wishlist_id |
Number | ID of the wishlist containing this item |
parent_id |
Number | Product ID of the parent product for the added item |
product_id |
Number | Product ID of the added item |
quantity |
Number | Quantity of the item in the wishlist |
notes |
String | Notes added to the item inserted in the wishlist |
dtadded |
Object | Date Time Stamp when the item was added to wishlist |
dtadded
Object#
Parameter |
Type | Description |
---|---|---|
time_t |
Unix Timestamp | Unix Timestamp for date created |
year |
Number | Year |
month |
Number | Month |
day |
Number | Day |
hour |
Number | Hour |
minute |
Number | Minute |
second |
Number | Second |
timezone |
Number | Offset from UTC |
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Function": "Runtime_WishListItemList_Insert",
"Session_Type": "runtime",
"Session_ID": "{{Session_ID}}",
"WishList_ID": {{WishList_ID}},
"Products": [
{
"Product_Code": "{{Product_Code}}",
"quantity": 1,
"Attributes": [
{
"code": "color",
"value": "red"
},
{
"code": "size",
"value": "large"
}
]
}
]
}
Example Response#
{
"success": 1,
"data": {
"wishlistitems": [
{
"id": 3,
"wshlst_iD": 3,
"parent_iD": 0,
"product_iD": 52,
"dtadded": {
"time_t": 1747949502,
"year": 2025,
"month": 5,
"day": 22,
"hour": 14,
"minute": 31,
"second": 42,
"timezone": -7
},
"quantity": 1,
"notes": ""
}
]
}
}
Error Responses#
Authentication Error:
{
"success": 0,
"error_code": "wishlist_customer_login",
"error_message": "You must have a customer account to add items to a wish list."
}
Missing Products Parameter:
{
"success": 0,
"error_code": "MER-JSN-RTM-00048",
"error_message": "Missing required parameter"
}
Invalid Product:
{
"success": 0,
"error_code": "MER-JSN-00023",
"error_message": "One or more parameters are invalid",
"validation_error": true,
"error_field": "Products[1]:product_code",
"error_field_message": "Product not found",
"input_errors": true,
"error_fields": [
{
"error_field": "Products[1]:product_code",
"error_message": "Product not found"
}
]
}
Invalid Wishlist:
{
"success": 0,
"error_code": "MER-WSH-00002",
"error_message": "Invalid wishlist specified"
}
Input Validation Error:
{
"success": 0,
"error_code": "MER-JSN-00001",
"error_message": "Invalid input parameters provided"
}