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 by category -- shipping charges doubled in cart

vossavantvossavant Member
in Help edited November 2010
Hi guys,

You referred someone to us that had a question on shipping charges in the cart (thankee). Here is the current shipping setup:

- Category A has flat rate shipping of $3.50 per shipment, plus a $1 per product handling fee
- Ditto for Category B

When I add a product from Category A and Category B to the cart, my total shipping is $9 instead of $5.50 (the flat rate gets figured for both categories, instead of just one).

Apparently this requires some custom JS work, but I'll admit I don't know where to start. I have a solid grasp of jQuery, so I'm wondering if one of ya'll would be kind enough to point me in the right direction.
  • brettbrett FoxyCart Team
    Basic idea pointers:
    There are tons of different approaches there. Give them a browse and let us know if you get stuck. It shouldn't be too bad if you've got a good handle on jQuery.
  • vossavantvossavant Member
    edited December 2010
    Hey Brett,

    Thanks -- I'll have a wade through those.

    Out of curiosity, has this type of question come up before? It seems like something FoxyCart should "get" -- why charge multiple flat rates when the products are in the same shipment? (I made sure each category is set to charge the flat rate "per shipment")


    In an effort to be less dopey, I'll put some pseudo code up here and see if this is in the right direction. I don't see any shipping elements in the fc_json object, but I'm assuming I can at least check if more than one category is present in the order. Something like:

    1. Loop through the products in the cart, inspecting their categories
    2. If more than one category is represented, then subtract the category-specific flat rate from the total shipping

    I see a couple of issues with this:
    - Unless there's a way to pull the flat rate dynamically, the script would need to be updated each time the shipping rates change
    - If categories have different flat rates, how do I know which one to use?
  • brettbrett FoxyCart Team
    The basic idea sounds good, and your issues are accurate. The rates would be hardcoded.

    To address the underlying concern though: Yes, our next major release will be a near complete rewrite of our shipping functionality. We know it's less than ideal at this point, but it's our top priority for our next non-maintenance release.

    Quick question I should have asked first: Are multiple categories absolutely necessary? Probably a good question to ask before diving in too deep.
  • Hi Brett,

    Thanks -- I know you guys are working hard on the shipping thing. It'll be sweet when it arrives!

    I don't know why there are multiple categories; I think it has to do with coupons. The client wants to apply coupons to one category, but not the other. I haven't worked with coupons much in the past (so I could be wrong here), but it doesn't look like you can apply coupons at the product level. Is that right?
  • brettbrett FoxyCart Team
    Ah, ok. That makes sense for the coupons. So yeah, you do need the multiple categories. Let us know how it goes.
  • lukeluke FoxyCart Team
    Hey vossavant. Not sure if this helps at all, but in answer to your "why" question, we built things that way because some products have to be shipped separately and need to handle their own shipping costs. For example, if I'm shipping a mattress and a pillow, the mattress might have a flat rate shipping costs of $20 but the pillow might ship separately for $5. Either way, I need to collect $25 from the customer. The "per shipment" wording is a little confusing as it's only there for multiship users. Without multiship, FoxyCart doesn't currently know how many shipments you have but it does try to take into account what the shipping should be. As we get further into the shipping improvements in the next version, we'll probably move more towards a "per order" idea with the highest value winning or something like that. In the meantime, the JavaScript tweaks on the checkout page (which Brett linked to above) are the way to go.
Sign In or Register to comment.