Select Shipping Rate based on Quantity

I'm using USPS Priority Mail Flat Rate Small Box, Medium Box, and Large Box. I want FoxyCart to modify the live rates based on Quantity. I think I have to use separate Categories to handle the dimension for each category.

That would entail a physical (actual) count of the maximum number of products that Category A, B, C, etc can fit into Small, Medium, and Large Flat Rate boxes, and modify the Live Shipping Rates to account for that.

Or, is there an easier way to do this?
Comments
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    The live shipping rates are already updated whenever the quantity of the cart changes - but we don't currently do dimensional shipping calculations - so it won't calculate the number of boxes needed based on the size of the objects to be placed in them. The returned rates are currently based on the origin, destination and total weight of the order.

    You could use our live rate modification snippet to alter which of the returned rates are displayed based on the current cart contents. If you're on version 2.0 you would use this snippet: https://wiki.foxycart.com/v/2.0/snippets/live_rate_shipping_modification and older versions this one: https://wiki.foxycart.com/snippets/shipping/live_rate_shipping_modification
  • It turns out that my client uses USPS Priority boxes that are not in the FoxyCart Shipping settings. Those are Region A and Region B boxes. They're used mostly for regions closer to Colorado, and once the customer ships to Midwest or East, the Priority Medium Flat Rate Box is used because it's cheaper.

    I'm feeling stuck as I don't know if writing Region A or Region B is going to actually pick up that rate on the Checkout. The store is live, and losing customers due to high shipping charges. What do you suggest I do?
  • After reviewing this PDF, I feel like I can write a custom config to better suit my client's needs. Wish I had seen this before. It's not your fault, it's my client's and mine. Mostly mine because I just took my client's word for it. Now I see it better. Maybe include this link with your USPS Shipping Store Settings??

    http://www.stamps.com/whitepapers/priority-mail-rate-guide.pdf
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    Thanks for the update - I'm glad you've found some better clarity! I'll create a ticket on our side to look into the availability of the regional rates with our USPS shipping rates.
  • That would be great. For the record USPS lowered their Priority Mail rates in September 2014. They reconfigured everything.
  • Do the Live Rates for USPS come from FC or USPS? I ask because nothing is matching the PDF rate guide linked above. When I login to USPS and manually recreate the order, it does match.
  • fc_jedfc_jed FoxyCart Team
    @atmospherix

    Unless you have the Live Rate Shipping Modification snippet or any other custom shipping snippet in place, the Live Rates for USPS comes directly from USPS, based on the location and weight data that we send them.
  • Thank you. I deselected the Modification snippet. The prices are better. But my client still wants the Regional A and B Boxes available per that PDF. link above.
  • fc_adamfc_adam FoxyCart Team
    edited December 2015
    @atmospherix,

    I've created a ticket for the regional rates. Unfortunately I can't give you an ETA on when we will be able to add support, but we'll update you as there are any developments.
  • Thanks Adam. I'm looking forward to it. FC has a discount Calculator - how about a Shipping Configurator?
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    We have a huge rebuild of our shipping functionality in the near future that will make our shipping a whole lot more robust and configurable. We're really excited for what it will allow for everyone, but unfortunately don't have an ETA for it just yet.
  • Now I just found out that the client wants insurance added to orders over $50. How do I do that? Insurance is $3.50...

    My skills are not logic/programming.
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    To do that you would need to make use of the javascript snippet to adjust the shipping rates dynamically based on the order total.

    Could you confirm what store version you're using?
  • Version 2.0 I think I'm seeing it now in the examples of Live Shipping Update. I'm going to try this:

    if (FC.json.total_item_price >= 50) {
    FC.customLiveShipping.update('Priority Mail', '+3.50');
    }

    Next I have to figure out how to switch the price from Priority to a flat rate of $11.30 (Medium Flat Rate) based on QTY. It would be super helpful if there was a way to factor in Zones.

    Client ships a majority of orders within 600 mile radius (Zone 1-4.) Is there a way to write logic to increase the prices for Zone 5-9?
  • fc_jedfc_jed FoxyCart Team
    @atmospherix

    Unfortunately, unless it's based on a definite address, there's no way to increase the prices based on subjective zones.

    As for the quantity logic, you could write it like this:
    x = NUMBER_YOU_WANT_TO_BASE_CONDITION_ON;
    if (FC.json.item_count < x) {
    FC.customLiveShipping.hide('all');
    FC.customLiveShipping.add(300, 11.30, 'Medium Flat Rate', '');
    }
    The code snippets hide all other rates (if deemed necessary) and adds the Medium Flat Rate as the only shipping option.

    Is that what you were looking for?
  • Yes, how do I change that to cover 9 different Categories and their varying amounts? Thank you Jed.
  • fc_jedfc_jed FoxyCart Team
    @atmospherix

    Would you mind confirming what you mean about covering 9 different Categories and their varying amounts? FC.json.item_count considers all items in the cart. Would you want it to only consider items that fall under certain categories? If you could detail your requirements, it would definitely help us come up with a resolution quicker.
  • This is what I have category-wise now, using previous Configuration logic:

    var HONEY3 = 0;
    var HONEY5 = 0;
    var HONEY9 = 0;
    var HONEY18 = 0;
    var HONEYSQ1 = 0;
    var HONEYSQ12 = 0;
    var HONEYSQ2 = 0;
    var HONEYSQ24 = 0;
    var HONEYLARGE = 0;
    var HONEYJUG = 0;
    var HONEYCOMB = 0;
    var CANDLE = 0;
    var SOAP = 0;
    var BEESWAX = 0;

    for (p in FC.json.items) {
    switch (FC.json.items[p].category) {
    case "HONEY3":
    HONEY3 += FC.json.items[p].quantity;
    break;
    case "HONEY5":
    HONEY5 += FC.json.items[p].quantity;
    break;
    case "HONEY9":
    HONEY9 += FC.json.items[p].quantity;
    break;
    case "HONEY18":
    HONEY18 += FC.json.items[p].quantity;
    break;
    case "HONEYSQ1":
    HONEYSQ1 += FC.json.items[p].quantity;
    break;
    case "HONEYSQ12":
    HONEYSQ12 += FC.json.items[p].quantity;
    break;
    case "HONEYSQ2":
    HONEYSQ2 += FC.json.items[p].quantity;
    break;
    case "HONEYSQ24":
    HONEYSQ24 += FC.json.items[p].quantity;
    break;
    case "HONEYLARGE":
    HONEYLARGE += FC.json.items[p].quantity;
    break;
    case "HONEYJUG":
    HONEYJUG += FC.json.items[p].quantity;
    break;
    case "CANDLE":
    CANDLE += FC.json.items[p].quantity;
    break;
    case "SOAP":
    SOAP += FC.json.items[p].quantity;
    break;
    case "BEESWAX":
    BEESWAX += FC.json.items[p].quantity;
    break;
    }
    }

    What I want to do is actually set the rate, not modify it. For example, HONEY18 =<3 will be $6.16 and =>4 will be $7.54

    Those rates are actual rates that my client actually uses when shipping products. I have a spreadsheet of various honey sizes, their weights, how many fit into what size box and what she actually expects the rate to be based on weight and Zone. The shipping page in the Docs is absolutely true: it's complicated (!!!!) I saw Star Wars yesterday and I wish I could growl like Chewie and make this all work out. Thank you Jed
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    The code Jed posted previously will allow you to set a rate rather than update it - like this:
    if (HONEY18 <= 3) {
    FC.customLiveShipping.hide('all');
    FC.customLiveShipping.add(300, 6.16, 'USPS', 'Medium Flat Rate Box');
    } else {
    FC.customLiveShipping.hide('all');
    FC.customLiveShipping.add(300, 7.54, 'USPS', 'Medium Flat Rate Box');
    }
    You can also update an existing rate to set it to a specific amount like this (assuming you'd already added that custom rate above:
    FC.customLiveShipping.update(300, 7.54)
  • Thank you Adam. I think I'm set.
  • fc_adamfc_adam FoxyCart Team
    @atmospherix,

    I'm not sure if your client still needs the regional rates - but we've just rolled out support for them, they're now selectable from the shipping section of the FoxyCart administration within USPS's rates.
Sign In or Register to comment.