The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Setting minimum order values

salsal Member
in Bugs & Feature Requests edited November 2007
I was working through a project for a client and the matter of setting a minimum value came up.

I've gone through the settings and docs and although there is access to the JSON object, this check would need to be done on checkout so if this is easily possible, could this be made a setting? The option to set an order minimum (either price or quantity, or both) would be awesome guys.

I'm hoping this is just a "this is how you do it" but if not then I suppose it's a feature request.
Comments
  • brettbrett FoxyCart Team
    We're actually cooking up an extended JSON object that'll be available on the cart page, so you'd be able to hide the "checkout" link if the cart doesn't meet a minimum criteria. That'd get you where you want to go, yes? Just check the JSON cart object and disable/enable the checkout button on the cart to prevent even getting to the checkout if the order minimum isn't met.

    Should be here in the very, very near future with 0.3.0.
  • Actually, this should be possible now. Now that you mention it, just hiding Checkout if fc_json.cart.length < X, no?
  • lukeluke FoxyCart Team
    Hey Sal. You're right, except that the json object isn't currently available on the cart page. We're going to add it to the 0.3.0 release. Stay tuned! :)
  • cfncfn Member
    Luke/Brett

    Want to go over those instructions one more time?

    Is there a way to add some text to the cart also so the customer is informed about the minimum order amount?
  • Was this ever added? I'd love some idea of how to get this working. Thanks!
  • brettbrett FoxyCart Team
    Wow this is an old thread. I'm pretty sure this has been asked and answered numerous times, but it might be difficult to find on our forum.

    The short version is: Use the JSON on the cart to remove the checkout if the quantity isn't high enough. Replace it with a notification of the minimum quantity. ... I know we've gone over this and I'm pretty sure there's code available, but I can't find it either.

    If you need help let us know.
  • I couldn't/can't find any other posts. Can you try to find some code / directions for me? I understand in theory what needs to be done, but I'm not sure how to do it.
  • lukeluke FoxyCart Team
    hey razorfrog.
    Try this out. Add a div to your cart template like so:
    <div id="minimum_purchase_notice">Your order must meet our minium purchase requirement of $20</div>
    
    You'll probably want to include some CSS to mark this as hidden by default.

    Then include this javascript in your template:
    <script type="text/javascript" charset="utf-8">
    jQuery(document).ready(function(){
    if (fc_json.total_price < 20) {
    	jQuery(".fc_cart_checkout").hide();
    	jQuery("#minimum_purchase_notice").show();
    } else {
    	jQuery(".fc_cart_checkout").show();
    	jQuery("#minimum_purchase_notice").hide();
    }
    })
    </script>
    

    Hope that helps.
  • fc_marijafc_marija FoxyCart Team
    The code snippet shown here in this thread is for an older version. Please refer to this article if you are using version 2.0. https://wiki.foxycart.com/v/2.0/snippets/dynamically_blocking_checkouts
Sign In or Register to comment.