Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Woocommerce - Is it possible to add variable products to a grouped product?

I have list products in a particular group... in this case, a bed set. comforters, pillows, shams, etc. Some are variable products (comforter sizes), and some are simple products (pillows).

I would like to create a product group called XYZ Awesome Bedroom Set and include both the variable and simple product types. Unfortunately, Woothemes officially only supports adding simple products to groups.. but I'm not sure why. Any ideas?

Is there anything in the core or WC template files that I can overwrite to allow access for variable products in groups? I have looked at the available plugins and tried dozens of fixes in the core, but no luck!

Anything would be helpful at this point.

Thanks.

like image 643
Joseph Wer Avatar asked Mar 08 '15 01:03

Joseph Wer


1 Answers

It is possible to do this with grouped products in Woocommerce 3.0+, but does require editing one line in a core Woocommerce file. It's super easy once you know what to change, and it's never recommended to change core files, but perhaps this can help you figure out how it works, then come up with a better solution.

The file is located here: /wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-linked-products.php

Change line 15 (HTML <select> tag)

FROM: data-action="woocommerce_json_search_products"

TO: data-action="woocommerce_json_search_products_and_variations"

Yes, it really is that simple. This will allow the Select2/SelectWoo search box to pull in both parent products and individual variations.

Keep in mind, any future Woocommerce update will override this change. So you will need to override the file permanently, or track it in Git to highlight changes to the file, etc.

like image 192
tobinfekkes Avatar answered Nov 18 '22 18:11

tobinfekkes