Home › Forums › Basel support forum › Variations issue with default form values are sold out scenario
Variations issue with default form values are sold out scenario
- This topic has 12 replies, 2 voices, and was last updated 5 years, 5 months ago by Artem Temos.
-
AuthorPosts
-
July 3, 2019 at 12:13 am #131064
tiantzerParticipantHello great Xtemos team,
I hope you all well.I’v experience a issue which is the variable product had set a default form values while the default values are sold with “Do not allow” for backorders,
I cannot select another variation or add another variations to shop cart and will showing
“Please select some product options before adding this product to your cart.”.The solution is that I need to click clear first, after that I can able to select other variations with stocks. I think it’s important with people need set their default form values and user experience are effected.
I’d set the default form values with white color and it
‘s already sold out with not allow for backorder option, please visit the link below and provide the solutions.Thanks.
July 3, 2019 at 6:43 am #131074
Artem TemosKeymasterHello,
Could you please check how it works with some default WordPress theme like twentysixteen to understand is it our theme issue or not?
Regards
July 3, 2019 at 2:20 pm #131159
tiantzerParticipantHi,
It’s normal with default WordPress themes because those default themes doesn’t preselect variations even have had set default form values.
Thanks.
July 3, 2019 at 2:21 pm #131160
Artem TemosKeymasterSorry, what do you mean? The default variation is a WooCommerce functionality and should work with a standard theme as well.
July 3, 2019 at 2:27 pm #131162
tiantzerParticipantHello,
I mean that issue does not happen with WordPress default themes but it’s happen with BASEL theme.
Because the default theme does not preselect variation which is sold out, but BASEL theme still preselect variation while the default form values had been sold out and cause that issue.I’m apologize my english.
July 4, 2019 at 7:39 am #131247
Artem TemosKeymasterCould you please send us your admin and FTP access so we can check what is wrong?
July 4, 2019 at 7:42 am #131249
tiantzerParticipantHi~
July 4, 2019 at 7:45 am #131250
tiantzerParticipantwordpress login address:
July 4, 2019 at 7:58 am #131255
Artem TemosKeymasterTry to add the following code snippet to the Custom JS area in Theme Settings to fix this issue.
jQuery('.variations_form').each(function () { var $variation_form = jQuery(this); $variation_form.on('update_variation_values', function (e) { // Count available options. $variation_form.find('.variations select').each(function () { var $select = jQuery(this); var attached_options_count = $select.find('option.attached').length; var selected_attr_val = $select.val() || ''; var selected_attr_val_valid = true; // Check if current selection is in attached options. if (selected_attr_val) { selected_attr_val_valid = false; if (0 !== attached_options_count) { $select.find('option.attached.enabled').each(function () { var option_value = jQuery(this).val(); if (selected_attr_val === option_value) { selected_attr_val_valid = true; return false; // break. } }); } } // Choose selected value. if (selected_attr_val) { // If the previously selected value is no longer available, fall back to the placeholder (it's going to be there). if (!selected_attr_val_valid) { $variation_form.find('.basel-swatch[data-value=' + selected_attr_val + ']').removeClass('active-swatch'); } } }); }); });
Also, remove the code you have there since it is broken and may cause problems with the fix http://prntscr.com/oaelov
July 4, 2019 at 8:12 am #131256
tiantzerParticipantHi,
I have add that code to the custom js and remove another codes but didn’t works.
Attachments:
You must be logged in to view attached files.July 4, 2019 at 8:32 am #131264
Artem TemosKeymasterSorry, move it to document ready section there.
July 5, 2019 at 10:49 am #131459
tiantzerParticipantIt’s works for me now, thanks for help.
😀
July 5, 2019 at 12:41 pm #131470
Artem TemosKeymasterGreat, you are welcome!
-
AuthorPosts
The topic ‘Variations issue with default form values are sold out scenario’ is closed to new replies.
- You must be logged in to create new topics. Login / Register