Variants lose category connection

When adding an existing variant to a base product in Back Office, the variant seems to lose all its category connections. The variant will be visible under the base product’s “Variants” tab but not in the connected category’s “Products” list. Also when I call baseProduct.GetPublishedVariants on the base product, the variant is not included in the response. I have to manually add the variant to the category’s “Products” list.

Is this by design or a bug?

Litium version: 6.2.2-patch-1809301256

If you add a variant to the base product after the base product already is connected to one or multiple categories of simple product lists the variant is not added automatic to the same categories or simple product lists that any of the base product variants already belongs to.

So I would say this is by design.

OK. Is there a reason to why you chose to design it like that? Like are there any technical issues with connecting the added variant to all the base product’s categories? I’m thinking of using the event system to add the variant to the base product’s category/ies when the product is saved in backoffice, is that a bad idea?

If you adding another variant to the same base product it is not sure that it should be added to all categories, simple product list etc before you have added all values for the fields and populated with price and activate the variant on the website.

No technical issues, more businesses rules for when the variant is ready to be published to customers.

I think that should be a doable solution to get the variant auto included in the categories and can’t think of any pitfalls with doing that.

Alright, I’ll try something along those lines then. :slight_smile: