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.

Shipping based on Price

jlclayton09jlclayton09 Member
in Bugs & Feature Requests edited March 2011
I've setup a store, and I'm trying to setup shipping to vary by price.

ex. 0-$25 = $6.00 shipping, $25.01 - $50.00 = 8.00 shipping, etc.

Thanks in advance!
Comments
  • brettbrett FoxyCart Team
    The first step would be to take a look at this page:
    http://wiki.foxycart.com/docs:advanced:forum
    There are lots of links there to forum posts, many of which may deal with this type of tiered shipping and have code that you can use to get what you want.

    (And yes, it should be easier. We're working on shipping for our next major release. Please vote for it here: http://requests.foxycart.com/ and include your desire for tiered shipping based on price, if you could. Thanks.)
  • Thanks Brett!
  • lancelance Member, Community Support Member
    @jclayton09 -

    Just wanted to check in and make sure you got this working the way you wanted. Let me know if you have any issues.

    Lance
  • @lance

    Unfortunately, no.

    I started working with the code from this thread: http://forum.foxycart.com/comments.php?DiscussionID=2880&page=1#Item_10

    changing the "weight" to "price" and "total_weight" to "total_price", and I changed my product delivery option to "flat fee and 0"

    Any help is appreciated. Thanks!
  • lancelance Member, Community Support Member
    @jclayton09 -

    Can you post the script that you've tried? If you've currently got it up on your store it would also be helpful if you could send the URL. You can whisper it if it's private.

    Lance
  • <script type="text/javascript" charset="utf-8">
    function calculateShipping(total_price) {
    var shippingCost = 0;

    if (total_price <= 25.00) {
    shippingCost += 6 * total_price;
    } else if (total_price >= 25.01) {
    shippingCost += 8 * total_price;
    } else if (total_price >= 50.01) {
    shippingCost += 11 * total_price;
    }

    return shippingCost;
    }

    jQuery(document).ready(function() {
    FC.checkout.config.orderFlatRateShipping = calculateShipping(fc_json.total_price);
    FC.checkout.updateShipping(-1);
    });
    </script>

    The website is: www.thyenterprises.com
  • lancelance Member, Community Support Member
    @jclayton09 -

    Interesting. In my testing, this is working. Where are you inserting this code in your checkout template? I didn't see it anywhere in your source.

    I should note that your math may not be quite what you intend. For instance, it is calculating a $120 shipping cost for a $20 item. Based on your criteria above, the correct code should be:
    <script type="text/javascript" charset="utf-8">
    function calculateShipping(total_price) {
    var shippingCost = 0;
    
    if (total_price <= 25) {
    shippingCost += 6;
    } else if (total_price >= 25.01 && total_price <= 50) {
    shippingCost += 8;
    } else if (total_price >= 50.01) {
    shippingCost += 11;
    }
    
    return shippingCost;
    }
    
    jQuery(document).ready(function() {
    FC.checkout.config.orderFlatRateShipping = calculateShipping(fc_json.total_price);
    FC.checkout.updateShipping(-1);
    });
    </script>
    
    Does this help?

    Lance
  • Lance,

    I finally got everything working. Thanks for you help!
  • lancelance Member, Community Support Member
    @jclayton09,

    Glad you got it working. Let me know if you need any other assistance.

    Lance
Sign In or Register to comment.