"use strict"; jQuery(document).ready(function() { if(wcuf_options.exists_at_least_one_upload_field_bounded_to_variations == 'true') jQuery(document).on('show_variation', wcuf_variation_has_been_selected); //only on product page, when a variation has been selected //hide qty selector if(wcuf_options.cart_quantity_as_number_of_uploaded_files == 'true' && jQuery('.wcuf_upload_fields_row_element').length > 0) jQuery('div.quantity, .quantity input.qty, #qty').hide(); }); function wcuf_variation_has_been_selected(event) { if(!wcuf_exist_a_field_before_add_to_cart) return; var variation_id = jQuery('input[name=variation_id]').val(); var random = Math.floor((Math.random() * 1000000) + 999); var formData = new FormData(); formData.append('action', 'reload_upload_fields'); formData.append('product_id', jQuery('input[name=add-to-cart]').val()); formData.append('variation_id', variation_id); formData.append('wcuf_wpml_language', wcuf_wpml_language); //UI wcuf_show_hide_add_to_cart_area(false, false, 600, 400); //Force hiding the add to cart button jQuery('.wcuf_'+wcuf_current_page+'_ajax_container').animate({ opacity: 0 }, 500, function() { //UI jQuery('.wcuf_'+wcuf_current_page+'_ajax_container_loading_container').html("