Product variant creation

The guide illustrates the strategy on how to create the variants for a given Product

Strategy

Differentiating product numbers for parent products and product variants.

The section is just a suggestion on how to standardize the product numbers.

Parent product number<unique_pattern> ; example ABC123XYZ

Product variant number : <unique_pattern><delimiter><variant_suffix> ; example ABC123XYZ###6

This is an efficient strategy to connect the product variants back to the parent product, if we split the string by the delimiter we can obtain the parent product at the first index position.

Assigning the product variants to the parent product on Shopware

Sample request body to create the Parent product.

{
"ean": "TESTEAN",
"name": "SNEAKERS RED",
"type": "product",
"price": [
{
"net": "210.04201680672",
"gross": "249.95",
"linked": true,
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"extensions": ""
}
],
"stock": 10,
"taxId": "1b7614e1e76c45bcaef55c8d7632fd69",
"width": "10",
"active": true,
"height": "10",
"length": "10",
"weight": "10",
"isCloseout": false,
"maxPurchase": 2,
"minPurchase": 1,
"releaseDate": "2020-10-14T12:00:00.000+00:00",
"restockTime": 3,
"purchaseUnit": "1",
"shippingFree": false,
"productNumber": "RF12XX11",
"purchasePrice": 0,
"purchaseSteps": 1,
"referenceUnit": "1",
"manufacturerNumber": "XYZ",
"parentId": null <<----- Can omit this field during the POST operation
}

The Product variant structure.

{
"ean": "TESTEAN2",
"name": "SNEAKERS RED",
"type": "product",
"price": [
{
"net": "210.04201680672",
"gross": "249.95",
"linked": true,
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"extensions": ""
}
],
"stock": 10,
"taxId": "1b7614e1e76c45bcaef55c8d7632fd69",
"width": "10",
"active": true,
"height": "10",
"length": "10",
"weight": "10",
"parentId": "c127c8fabc114d9ca6a87a82e953835e", <<----- IMPORTANT
"isCloseout": false,
"maxPurchase": 2,
"minPurchase": 1,
"releaseDate": "2020-10-14T12:00:00.000+00:00",
"restockTime": 3,
"purchaseUnit": "1",
"shippingFree": false,
"productNumber": "RF12XX11###3",
"purchaseSteps": 1,
"referenceUnit": "1",
"manufacturerNumber": "XYZ"
}

The step-by-step guide on how to create the product is explained in the guide below,

https://docs.alumio.com/alumio-shopware-connector/product-creation

Adding ParentId to the product variant

Step-1 - To Acquire the parent productNumber from the variant productNumber, simply split the product number by the delimiter and extract the element in the first index.

Step-2 - Perform a Merger Http transformation using the extracted parent productNumber and fetch the parentId from the Shopware.

Simply follow the product creation steps as shown in the product creation guide and the variant product will be automatically created under the parent product.