I found few solutions, but obviously none of them were working, so had to find it out by myself. So where to start – lets suppose we have our $post_id somewhere (I’m pretty sure there are lot of tutorials how to get post from database), so in first step we need to modify some base product settings:

So what happens here? In first line we are changing our product type to variants (you can do it also in product edit page in woocommerce), next line adds all possible colors we need (this can be any attribute like size, model or everything you want), $availableColors is just plain php array. Next step is:

Code above adds our color attribute to base product also with all possible values. Which is important here – is_visible should be set to 0 and is_variation should be set to 1. Then:

The last part is to insert or update your variation for each defined color. The variable $post_name can be anything you want, just should be same schema for all variants as we are using it to check if such variant already exists and should be only updated, or not exists and should be created. But you can use also SKU or GUID for this.

Finally after lot of troubles with preparing own API new version comes out, new stuff:

– fixed small bugs
– *** NEW *** added trakt.tv sync
– *** NEW *** now app is using our own database, cleaned and updated daily

Our API is currently used only for daily updates, when fetching new series old one is used, it will be changed in one of next version.

You can grab it here