On the checkout, I need it so that you can only proceed with payments if there are multiples of 4 in your cart (we sell coasters in sets of 4 but you can mix and match). We had an old Magento website and this was the code used:
jQuery(function ($) { var bla = $('#hidden-count').val(); var user_type = $('#hidden-user').val(); var item_left = 0; if (user_type == 5) { item_left = bla % 100; if (item_left > 0) { $('#pay-securly,#pay-securly2').attr('disabled', true); // $(".no_items_minicart").text("(Add " + (100 - item_left) + " more to complete order)"); $(".no_items_minicart").text("(ADD " + (100 - item_left) + " MORE COASTERS TO COMPLETE ORDER)"); } } else { item_left = bla % 4; if (item_left > 0) { $('#pay-securly,#pay-securly2').attr('disabled', true); //$(".no_items_minicart").text("(Add " + (4 - item_left) + " more to complete order)"); $(".no_items_minicart").text("(ADD " + (4 - item_left) + " MORE COASTERS TO COMPLETE ORDER)"); } } }); If anyone could help it would be very much appreciated!This forum is dedicated to Wix Code. For questions that are not related to code you can contact the Wix support team . You’ll get better help for your problem there.
It is related to Wix code. What I supplied was an old website, I am re-creating the website using Wix but need the same functionality.
Your question is about the shopping cart. The functionality you want may be something that is already built in to the cart feature. If not, then you might need Wix Code, but the code from your old site is not supported by Wix Code and will not work.
I was actually asking whether there is code I could enter to make this work with the cart. The old code was an example, I understand that it will not work. I have already asked the question to the Wix support team who have said that it is not built in and advised me that there may be code for it, hence, I am here.
OK, I understand. But the functionality of the cart may include the options you are interested in without resorting to code - which of course is the best way to go. If the cart does not have the behavior you’re looking for, then code could possible be used to achieve what you need.
To implement the logic in your sample code, see the Wix Code documentation for details on coding techniques and features.