Buttons have to be clicked twice before “add to cart” enables
-
Hi, it appears that there is some sort of possible timing issue with the plugin code that prevents the Add to Cart button from enabling properly on the first click. I reproduced this behaviour with both radio and the ddSlick options.
Problem: Clicking on the variation button doesn’t enable the Add to Cart button immediately. The user has to click the button twice.
Workaround: Click the variation button twice.
Workaround 2: The following change to the frontend.js code appears to work but only for the “radio” type (see the line below “WORKAROUND HERE”:
$(document).on('click touch', '.woovr-variation-radio', function() { var _this = $(this); var _variations = _this.closest('.woovr-variations'); var _click = parseInt(_variations.attr('data-click')); var _variations_form = _this.closest('.variations_form'); woovr_do_select(_this, _variations, _variations_form, _click); // WORKAROUND HERE: Repeat the call twice woovr_do_select(_this, _variations, _variations_form, _click); _this.find('input[type="radio"]').prop('checked', true); });
Edit: repeating the
woovr_do_select
call twice in the other respective code blocks fixes it for the other selector types (radio, select, ddSlick, etc.).Any idea why this issue occurs?
- The topic ‘Buttons have to be clicked twice before “add to cart” enables’ is closed to new replies.