woocommerce/assets/js
Brent Shepherd 501f0b752f Save product type before saving variations
WooCommerce prior to WC 2.4 saved the product type before any variations were saved because
WC_Meta_Box_Product_Data::save_variations() was called by WC_Meta_Box_Product_Data::save().
However, in WC 2.4 the variations are saved independently of other data about the containing
variable product, including product type. Because the product type hasn't been saved yet,
extensions that need to save their own variation level meta data can't know when saving
variations if the product is of the type they want to act on. They also can't check `$_POST`
to find out when saving variations, because 'product-type' isn't passed to that as it's
variable level meta data, not variation level meta data.

This patch passes the product type along with the variation level meta data when saving variations.
It then uses that to save the product type if the variable product has not yet been saved (and
therefore the product type has never been stored, which means calling get_product() would instantiate
a 'simple' product, as that is the default product type). This can lead to fatal errors if callbacks
expect the product type to be variable and attempt to call methods that only exist on those product
types, like variable_product_sync().

It will also update the product type if it was previously saved but has since changed. This prevents
fatal errors like that mentioned above but caused by switching from one product type, like a simple
product, to another, like a variable product.
2015-07-31 11:42:21 -07:00
..
admin Save product type before saving variations 2015-07-31 11:42:21 -07:00
chosen Changing all inefficient selectors of $('body') to $(document.body), which is about 80% faster (and even more on mobile, see https://jsperf.com/jquery-body-vs-document-body-selector/2 ). 2015-04-03 14:21:47 +02:00
frontend animate variations script markup changes 2015-07-31 14:04:55 +03:00
jquery-blockui Minify 2015-07-10 20:17:47 -03:00
jquery-cookie Updated jquery-cookie lib 2015-02-02 16:20:02 +00:00
jquery-payment Updated jquery.payment.js to version 1.2.4 2015-07-09 17:17:34 -03:00
jquery-qrcode Minify 2015-07-10 20:17:47 -03:00
jquery-serializejson Fixed chmod to jquery-serializejson 2015-07-29 19:16:27 -03:00
jquery-tiptip Compress with Grunt all external libraries 2015-05-25 11:42:42 -03:00
prettyPhoto Minify 2015-07-10 20:17:47 -03:00
select2 Minify 2015-07-10 20:17:47 -03:00
stupidtable Add stupidtable.min.js 2014-11-28 14:17:58 +07:00
zeroclipboard Minify 2015-07-10 20:17:47 -03:00