Purpose of Product Variants

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hello,

I am just wondering why a product variant is always created even if the product will never have any attributes. For example in my test environment I create a new product but have no need for any attributes such as size or color. Despite not having any attributes a variant is created anyway? Is this just in case it is needed down the road or is there some coupling or relationship between the base product and the variant I don't fully understand?

TIA
JB
11 years ago
ramjet69 wrote:
Hello,

I am just wondering why a product variant is always created even if the product will never have any attributes. For example in my test environment I create a new product but have no need for any attributes such as size or color. Despite not having any attributes a variant is created anyway? Is this just in case it is needed down the road or is there some coupling or relationship between the base product and the variant I don't fully understand?

TIA
JB

In Nop each product must have at least one variant (which is the normal case  and it is named "unamed").

The Product contains general info about the product and relations to categories, manufacturers, other products, stores (in multistore v3.0), etc.: name, description, specifications, mappings (categories, manufacturers, related/cross-sell products, stores, customer roles, etc.), images, etc.

The Product variants contain more specific info: name/description/image (if there are more than one variant), pricing, product type (normal, downloadable, recurrent, etc.) inventory, PV attributes (sizes, colors, etc.), etc.
11 years ago
This make sense. Thank you for the further clarification. So why then would the shoppingcartcontroller have both AddProductToCart and AddProductVariantToCart. If the main product is more relational and the variant more specific to the item being purchased then really best practice would be to always add a variant to the cart??

JB
11 years ago
ramjet69 wrote:
This make sense. Thank you for the further clarification. So why then would the shoppingcartcontroller have both AddProductToCart and AddProductVariantToCart. If the main product is more relational and the variant more specific to the item being purchased then really best practice would be to always add a variant to the cart??

JB

My guess is that as the name says: 1st for adding a one-variant product the 2nd to add a variant when you have more than one as in the example I pointed before
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.