woothemes/woocommerce — pull request #3817 by franticpsyx (2013-09-22 19:42:56+00:00)
Title: Allow variations JS to be used on multiple products in the same form.

The variations JS was changed some time ago, in order to allow multiple variations forms under the same page.

However, in its current state, the script does not allow multiple variable products under the same form.

This is a big problem for extensions such as Product Bundles and Composite Products: To use the variations JS, both extensions must place all items in their own forms, while using a separate form for posting data. This is a major issue, because:

1) JS hacks are required to copy-paste variation data from the bundled item forms to the form that gets submitted.

2) To support extensions such as Addons and Name-Your-Price in Bundles/Composites, the same copy-paste hacks must be used.

no. 2 is a big issue with Addons, because in some cases cloning fields is hard / impossible to do in a clean way (file inputs, for example). It also makes maintenance a constant problem.

The solution is simple and only requires the form tag to be removed from the jQuery selectors, and simply relying on the class. This will make it possible to nest multiple class="variations_form cart" divs under the same form, without having to rely on hacky cloning.

The change doesn't affect anything, as far as I can tell. However all extensions that want to make it possible to nest multiple products under the same form should follow the same logic and remove the form tag from any jQuery selectors.

It would be nice to see this in 2.0.15, in order to start preparing for more drastic changes in time for 2.1...