FoxyCart / foxyshop

FoxyShop - WordPress plugin for FoxyCart
GNU General Public License v2.0
10 stars 8 forks source link

Setting the code in a variation breaks inventory checking #19

Closed adamjudd closed 5 years ago

adamjudd commented 5 years ago

It appears there is a small bug in the variations javascript which is causing the inventory checks to fail if there is a variation which sets (rather than adds to) the code along with other variations that add to it.

Specifically it looks to relate to this line in variation.process.jquery.js:

if (new_codeadd) inventory_code = $("#fs_code_" + current_product_id).val() + new_codeadd;

That's getting the default code from the form, but it should instead just use the new_code variable passed to it, which has already been set as inventory_code:

if (new_codeadd) inventory_code += new_codeadd;