Magento 2 Create a Configurable product using SOAP API

Uploading a Simple product in Magento is pretty easy and straightforward. Creating a configurable product is a little bit more difficult.

In this post you’ll see C# code on how to create a configurable product in Magento 2 using the SOAP API. There’s not a lot of sources on the internet for this and it took me a while to figure this out.

This is how it works:

  • Create and upload the simple products (and don’t forget their SKU’s)
  • Create and upload the configurable product (specify the attribute that’s changing and don’t forget it’s SKU)
  • Link the simple products to the configurable product

Now let’s get started.

Create and upload the simple products

Create and upload the configurable product

You’ll see I make a call to my own method GetProductAttributesByAttributeSetAsync. Basically it’s used to know the attributes of the attributeSet the product is in. I have made my own attributes like color_config or size_config. If an attributeSet has an attribute with _config in the name it registers this as productOption. These are the options that will have a dropdown in your product page.

You need to configure product options in your configurable product

Link the simple products to the conifgurable product

 

Leave a Reply

Your email address will not be published. Required fields are marked *