In Opencart we can create a variant product based on the master product. A product variant is a pre-defined option product. For example, let’s say we add a product with red and blue options (product id 50), now we can create a variant based on this product and select the option red only to make the red variant product (product id 51 with master id 50).
How to add the product variant in Opencart?
Go to products listing or Catalog>>Products and click the dropdown near the edit button in the Action column and you will see the “Add Variant”, click it and you are ready to add the variant.
Once you clicked the “Add Variant”, all the data of the master product is copied and a new product is created where you can override the data as per your need. Please note that when you override the variant product data, the field data which is changed will not get replaced with the master product data when the master product data is changed and saved. If the field data is not overridden then when master product data is changed the changes will be seen on the variant product as well.
How to override the variant product data?
In the Variant product, you will see a toggle icon for every field where you can click On it and change the field data as per your need.
Let’s say you change the product name but did not change the product description of the product variant, then when you changed the product name and description of the master product then the changes will be seen only on the product description but not on the product name. Variants products are pre-selected options so you cannot change the options on the variant product.
Note: if you save the product variant after the master product’s data is changed then the variant product overridden data is replaced by the master product’s data, so be careful.
Select the Option:
Change the SEO URL:
Now click save and you have added the product variant.
As the product variants are also added like new standalone products so you can view them on the category page as well.
Improvements needed:
- When we select the option in the master product and have the product variants, then it would be better to show the product variant page.
- When the option price is added, it is better to show the added price on the product variant page, right now it is showing as the product price instead of the Option price.
- SEO improvements for the product variants.
Conclusion:
In this way, you can easily create product variants from master products and customize your own data except for options and making it easy to create product variants. Please let us know if you have any kind of projects, you can email us at webocreation.com@gmail.com. Hope you liked this tutorial, please subscribe to our YouTube Channel and get more Opencart free extensions. You can also find us on Twitter and Facebook.