Reputation: 420
How do I set a minimum quantity in order to checkout in my online store?
Each item in my store can be added to the cart in a quantity of "1" but I'd like a minimum of 12 items total before allowing to checkout.
Any easy fixes on how to do this?
I am using Weebly for my site and all I've been able to do is set each item at a minimum of 12 items each but I need a total of 12 items minimum before allowing checkout.
Therefore, as the user clicks the checkout button, and the minimum is not reached I'd like there to be a notice saying "add more items to your cart".
http://poloniafoods.weebly.com/store/p10/kozackie
Upvotes: 0
Views: 562
Reputation: 676
Unfortunately, I do not have enough reputation to comment on stackoverflow, so this is coming as a 'answer'.
I'm not sure of any way to do this with Weebly. The carts count/content seams to load last, so any JQuery ect.. wouldn't be able to count the contents. Even using something like var str = $( "span#wsite-nav-cart-num" ).text();
returns a dash - and not the actual number that appears in the CART (1).
I'm not sure why you would want this anyway, but that's up to you. I would suggest submitting a features request to Weebly.
P.S.. Weebly has community.weebly.com where your Weebly questions might get some better results,.. that is, unless someone directed you here.
EDIT:
Actually,.. After seeing your comment, it popped into my head, you can do a 'touchstart mouseover' event. Try this, in your Settings > SEO > Footer Code.
<script>
jQuery(function() {
var $ = jQuery;
$(document).on('touchstart mouseover', 'a#wsite-com-minicart-checkout-button', function(e) {
var totalCount = $( "span#wsite-nav-cart-num" ).text();
var totalNeeded = 12;
if (totalCount < totalNeeded) {
var totalItems = totalNeeded - totalCount;
$("a#wsite-com-minicart-checkout-button").click(function(event){
event.stopImmediatePropagation();
alert('We require ' + totalNeeded + ' items in order to checkout. You currently have ' + totalCount + '. Please add ' + totalItems + ' more items to the cart.');
return false;
});
}
});
});
</script>
The downside, something with the cart causes the alert to appear twice. And while it should work with a Responsive Theme(your current Theme), this wont work with Weebly's classic mobile Themes.
In the end, it will still be better if Weebly builds this into their system. Hope that helps!
Upvotes: 1