[solved] Discount per item when 2 or more of the items are ordered

sunsurfsunsurf Member
in Help edited February 2012
Hello Team Foxycart,

I am using foxycart 0.7.1 with a modx evo 1.0.5 site in Australia for a small home delivery service.

The site features 2 categories of products:
1. boxes of organic fruit and veg and
2. extras (eg everything else such as groceries, bread etc)

Boxes cost $50 each.

However, if a customer orders 2 or more of any of the boxes, the client would like the price of each box to be reduced to $45 each (ie $5 off per box when multiple boxes are ordered).

So the price for:
- 2 boxes would become $90
- 3 boxes would become $135
- etc

All of the fruit and veg boxes have "boxes-" in their code like below...:
+ boxes-mixed
+ boxes-veggie
+ boxes-fruit
+ etc

It would be cool if this could happen in the cart and be carried through to checkout.

Is there any magic code to make this happen with the awesome foxycart?

In case it is relevant (to avoid js conflict between custom codes), this is further to this forum post which related to at least one of the boxes being mandatory to place an order:
http://forum.foxycart.com/discussion/4687/#Item_7

Thanks in advance for your help.
Comments
  • fc_adamfc_adam FoxyCart Team
    @sunsurf,

    Are all of the boxes in their own category?

    If they are, you can simply create a new coupon with a coupon type of "amount based on quantity" with a coupon details of "incremental|2-5", and then simply apply that coupon to only the boxes category.

    Then people can use the coupon code on your cart to get a discount of $5 for every order when 2 or more boxes are ordered
  • They are within the CMS but not within the Foxycart admin system.

    Categories are not used for this shop at the moment.

    Is there a tricky way to do it with js?
  • I have just implemented categories to see if I can get it working (I forgot I had created and filled out a category TV for each product within MODx so it was easy to tweak). Its close but I have not quite got it right at the moment....

    With coupons it looks the customer has to type that into the cart to apply - we want the discounting to be automatic when 2 or more boxes are added to the cart.

    This is a great suggestion Adam - thanks for pointing me in the right direction.

    I think perhaps discounting by category is more along the lines of what we want.

    If I use "discount by an amount based on quantity" with "incremental|2-5" in the discount details field it returns incorrectly...
    The price for:
    - 1 box as $50 (correct)
    - 2 boxes as $95 (incorrect with $2.50 off per box - it should be $90 with $5 off per box)

    If I remove the word incremental and change the discount field to "2-5", it works exactly how we want it.

    Can you forsee an issue in not using incremental? Or advise the solution to get it working with incremental in the discount details?

    Thanks Adam - you are awesome as always!


  • sunsurfsunsurf Member
    edited February 2012
    The $5 per box discounts are applying when 2 or more boxes are being ordered (by applying a discount per category (eg boxes)) which is great.

    However, there's one thing I didn't realise going into this...

    The discount should apply to all boxes EXCEPT for the "fruit" boxes with "work" selected as the option.

    Eg
    sku = boxes-fruit
    Category = boxes
    Options = <option value="home">home</option> <option value="work">work</option>

    The discount SHOULD apply to "fruit" boxes with "home" selected as the option...

    But NOT to "fruit" boxes with "work" selected as the option.

    Any ideas on that curly one Adam?

    Thanks so much for your help.
  • fc_adamfc_adam FoxyCart Team
    Ah ok,

    So what you'll want to do is delete the coupon you created and navigate to the relevant category in the categories section and select a category discount for that category, putting in the same settings you did for the coupon. This will mean that the discount will automatically apply for products with that category.

    As for avoiding the fruit boxes, you'll just want to add them to a different FoxyCart category, so only those which will be discounted will be added to the category.

    And sorry, yeah you don't want "incremental" in your coupon code.
  • sunsurfsunsurf Member
    edited February 2012
    Ok thanks Adam, category discount it is (minus incremental).
    As for avoiding the fruit boxes, you'll just want to add them to a different FoxyCart category, so only those which will be discounted will be added to the category.

    I think that will exclude "Fruit boxes" with the "home" option selected from the discounting though which should still be available for the discount deal - we only want to exclude "fruit" boxes that have the "work" option selected.

    Is there a way to exclude a category discount based on a particular option selected?

    Or have you got any other tricks up your sleeve?

    Thanks Adam
  • fc_adamfc_adam FoxyCart Team
    edited February 2012
    Hi sunsurf, you'll want to add a modifier to your select values. You can find out more information about those at the bottom of this page: http://wiki.foxycart.com/static/redirect/add_to_cart

    Essentially though it would look something like this:
    <select>
    <option value="work{y:box-work}">Work</option>
    <option value="home">Home</option>
    </select>
    

    This way, if a person selects Work, then the category would be changed to "box-work", otherwise it will use whatever is set in the category input.
  • Hi Adam,

    You are a genius, that is so awesome! That is exactly the trick I was hoping for.

    Is there anything that Foxycart can't do?

    I never cease to be amazed with how clever Foxycart is - and your level of service is impeccable as always.

    Thanks Adam.

    Nice beard by the way! You would definitely win Movember with that.
  • ps where did your beard go? ha.
  • brettbrett FoxyCart Team
    Haha, I put the beard up so @fc_adam would finally update a picture. He apparently was more motivated by that than by me asking politely multiple times :)
  • fc_adamfc_adam FoxyCart Team
    edited February 2012
    ps where did your beard go? ha.

    Hah. @brett was impatient with me not adding my avatar so he added one for me to give me some incentive :) Unfortunately I don't have a moustache of epic proportions.

    Glad that worked for you too!

    [edit] Brett beat me to it!
  • ha, classic!

    That beard was of epic proportions - bring back the beard!

    Love your work team Foxycart.
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    Dang.... I wasn't quick enough on the ball to catch a glimpse of this famous beard. I'm sort of picturing something like this:

    brett-keisel-beard.jpg
  • brettbrett FoxyCart Team
    mustache-16.jpg

    From this page, which must be one of the greatest pages on the internet, ever.
  • sunsurfsunsurf Member
    edited February 2012
    ha! love it.
    that was close sparkweb, but less manicured.
    That really is an awesome page Brett.
Sign In or Register to comment.