Actions16
- Customers Actions
- Options Actions
- Orders Actions
- Products Actions
- Variants Actions
Overview
The "Create Variant" operation under the "Variants" resource allows users to add a new product variant to an existing product in the Sharpei system via its API. This node is useful for e-commerce or inventory management workflows where products have multiple variants (e.g., different sizes, colors, or configurations), and you want to programmatically create these variants with specific details.
Typical use cases include:
- Adding new size or color options to a product catalog.
- Automating variant creation when importing product data from external sources.
- Managing inventory by creating variants with unique SKUs, barcodes, and pricing.
Properties
| Name | Meaning |
|---|---|
| Product Pid | The unique identifier (Pid) of the product to which the variant will be added. |
| Variant Data (JSON) | JSON-formatted data describing the variant's attributes such as selling price, title, SKU, remote ID, barcode, and cost. |
The "Variant Data (JSON)" property expects an array of objects, each representing a variant with fields like:
selling_price: The price at which the variant is sold.title: The name or title of the variant.SKU: Stock Keeping Unit identifier.remote_id: An external or remote identifier.barcode: Barcode associated with the variant.cost: Cost price of the variant.
Example JSON input:
[
{
"selling_price": "19.99",
"title": "Red T-Shirt - Large",
"SKU": "TSHIRT-RED-L",
"remote_id": "12345",
"barcode": "0123456789012",
"cost": "10.00"
}
]
Output
The node outputs the response from the Sharpei API after attempting to create the variant(s). The output is structured as JSON data containing details about the created variant(s), including identifiers and any metadata returned by the API.
If the API supports it, binary data output is not expected for this operation since it deals with JSON-based product variant information.
Dependencies
- Requires an active connection to the Sharpei API.
- Needs an API authentication token or key configured in n8n credentials to authorize requests.
- The base URL for the API is
https://api.prod.gosharpei.com/api. - Proper network access to the Sharpei API endpoint must be ensured.
Troubleshooting
- Invalid Product Pid: If the provided product Pid does not exist, the API may return an error indicating the product was not found. Verify the Pid before running the node.
- Malformed JSON in Variant Data: Ensure that the JSON input for variant data is correctly formatted. Syntax errors or missing required fields can cause request failures.
- Authentication Errors: Missing or invalid API credentials will result in authorization errors. Confirm that the API key/token is correctly set up in n8n.
- API Rate Limits or Downtime: If the API is unreachable or rate-limited, the node will fail. Check API status and retry later if needed.
Links and References
- Sharpei API Documentation (Assumed official docs for further details on variant creation)
- n8n Documentation on Creating Custom Nodes
