Using Product variations as product addons

This is more a question for advice than a bug or problem. I'm building a Woocommerce based plugin and I was looking to at way of using the core woocommerce/ wordpress as best as possible without the need for dependencies.

My question for advice centres around using variations also as product addons as I'm trying to develop the functionality of being able to

  1. Offer checkbox type variations
  2. Allow selection of multiple variations per attribute that is used for the variations
  3. Still have the variations add the value if any to a base price

I think this way because variable product variations already have the features needed for a product addon without needing a product addons plugin. All I need to do is improve the options for attribute types and facilitate multiple variation value selection per variation attribute.

Do you think this is a good principle concept?

Topic plugin-development Wordpress

Category Web


Discussions on WooCommerce is off-topic here, but can't resist myself answering. I faced a similar issue couple of months back and my solution was something like this.

  1. Remove the default add to cart form and variation choices in single variable product page. You can use JS or modify the template.

  2. Add custom form with checkboxes and quantity input for each variation

  3. Add those checked variations programmatically using woocommerce_add_to_cart hook.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.