From 90b4d6090e0b6efa8d89e24c59fd9970cdc936a1 Mon Sep 17 00:00:00 2001 From: Manos Psychogyiopoulos Date: Thu, 7 Jul 2016 11:07:20 +0300 Subject: [PATCH] use existing $form var to block/unblock Existing code could cause other `variations_form` elements on the same page to block/unblock as well. --- assets/js/frontend/add-to-cart-variation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js index 77d46602bb2..514becde94e 100644 --- a/assets/js/frontend/add-to-cart-variation.js +++ b/assets/js/frontend/add-to-cart-variation.js @@ -118,13 +118,13 @@ // Get a matchihng variation via ajax data.product_id = $product_id; - $( '.variations_form' ).block({ + $form.block( { message: null, overlayCSS: { background: '#fff', opacity: 0.6 } - }); + } ); $xhr = $.ajax( { url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_variation' ), @@ -140,7 +140,7 @@ } }, complete: function() { - $( '.variations_form' ).unblock(); + $form.unblock(); } } ); } else {