Product Variants [API]
Product Variants are variations of products for specific options.
Description | List available Product Variants |
Action | GET |
URL | <your URL here>/api/product_variants |
Sample request parameters | id_eq=11 --> Search by product variant id product_part_number_eq=PRD001 --> Search by product SKU product_id_eq=4 --> Search by product id with_options=true --> Show option details in the results with_images=true --> Show variant image URLs images Eg. <your URL here>/api/product_variants.json?product_id_eq=123&with_options=true&with_images=true |
Sample successful response | [ { "product_variant": { "id": 1, "option_value_ids": "4,1", "active": true, "product_id": 123, "code": "SKU-SM-RED", "reference_code": null, "quantity": "55.0", "cost": null, "integration_data": {} } } ] |
Description | Creates a Product Variant NOTES:
|
Action | POST |
URL | <your URL here>/api/product_variants |
Sample request body | Sample 1: Pass options using "option_value_ids": { "product_variant": { "id": 1, "option_value_ids": "4,1", "active": true, "product_id": 123, "code": "SKU-SM-RED", "reference_code": null, "quantity": "55.0", "cost": null, "remote_image_urls": [" https://res.cloudinary.com/url-to-image"] } } Sample 2: Pass options using "options": { "product_variant": { "options": [ { "option_name": "Size", "option_value_name": "Small" }, { "option_name": "Color", "option_value_name": "Red" } ], "active": true, "product_id": 123, "code": "SKU-SM-RED", "reference_code": null, "quantity": "55.0", "cost": null } } |
Sample Successful Response | { "product_id": 123, "code": "SKU-SM-RED", "quantity": "55.0", "active": true, "option_value_ids": "6,2", "reference_code": null, "cost": null, "id": 1, "integration_data": {}, "options": [ { "option_name": "Size", "option_code": "", "option_id": 2, "option_value_name": "Small", "option_value_code": "", "option_value_id": 6 }, { "option_name": "Color", "option_code": "", "option_id": 1, "option_value_name": "Red", "option_value_code": "", "option_value_id": 2 } ], "image_urls": [ "https://res.cloudinary.com/path-to-image" ] } |
Description | Update a Product Variant NOTES:
|
Action | PATCH |
URL | <your URL here>/api/product_variants/<id of Product Variant> Eg. <your URL here>/api/product_variants/1.json |
Sample request body | { "id": 1, "product_id": 123, "code": "SKU-SM-RED", "quantity": 55, "active": true, "option_value_ids": "6,2", "reference_code": null, "cost": null, "remote_image_urls": [ "https://res.cloudinary.com/path-to-image" ] } |
Sample Successful Response | { "product_id": 123, "code": "SKU-SM-RED", "quantity": "55.0", "active": true, "option_value_ids": "6,2", "reference_code": null, "cost": null, "id": 1, "integration_data": {}, "options": [ { "option_name": "Size", "option_code": "", "option_id": 2, "option_value_name": "Small", "option_value_code": "", "option_value_id": 6 }, { "option_name": "Color", "option_code": "", "option_id": 1, "option_value_name": "Red", "option_value_code": "", "option_value_id": 2 } ], "image_urls": [ "https://res.cloudinary.com/path-to-image" ] } |
Description | Delete a Product Variant |
Action | DELETE |
URL | <your URL here>/api/product_variants/ <id of Product Variant> Eg. <your URL here>/api/product_variants/1.json |
Sample request body | <empty> |
Sample Successful Response | <empty> |