Add Configurable Products via SOAP/XML-RPC

Icon NetzkollektivBy Dominik Krebs, Managing Director, CTO

The following tutorial will guide you through the whole process of adding Configurable Products using the Magento Core API. The tutorial covers both, the SOAP v1 API usage and the SOAP v2 API usage.

Please note, that the method catalog_product_type_configurable.assign used to combine the configurables with simple products is part of our Magento Core API Extension and not available in Magento natively.

Create a Configurable Product

To create a Configurable Product you need to use the catalog_product.create method. The product type can be specified with the first parameter. In this case you have to use ‘configurable’.

  • SOAP v2

Create a Simple Product

Now you have to create all the Simple Products – the variants of the Configurable Product. Every Simple Product corresponds to an attribute combination of the Configurable Product and may be bought by customers by choosing the appropriate options on the product page.

Create product attribute options

Every simple product needs to have its distinct options which can be chosen by customers.

Example: you want to create a product with the attributes color and size. So we need different sizes (e.g. S, M, L, XL, XXL) as well as different colors (e.g. green, yellow, red, brown, black) in the corresponding select-attribute.
To create these options, call the API as shown below:

  • SOAP v2

To assign the attribute option to the simple product, you need to use the option id (not: the value, e.g. XL) of the previously created option! Now, create the simple products with the option assigned:

  • SOAP v2

Putting all together

In the last step you need to link all products so that they can be bought via the Configurable Product. The API call is relatively simple. Mandatory are only the product id’s or skus of the Configurable and Simple products. If you want to set surcharges or you want to link only a subset of the configurable attributes, then also specify the other parameters.

  • SOAP v2

A short explanation of all options:

  • configurableProductId: Id or sku of Configurable Product
  • simpleProducts: an array which contains Ids or skus of all Simple Products which should be linked
  • usedAttributes: attributes which should be used to create the Configurable Product
  • labels: a key-value-pair including label and attribute code, to specifiy the title which will be shown at the product page for each attribute
  • prices: an array containing prices per attribut option (as absolut price or percent value)
  • store: by specifying the store you can change the attribute names per store (different languages)