By Peter Bell

How do you handle price breaks in e-commerce?

Believe it or not, I'm implementing my first price break system ever (I know it is a common requirement, but for whatever reason I've not had to do it before). With this system every product has a base price but also has 0..n price breaks which may or may not be unique to a given customer number.

I'm trying to come up with a best practices reusable approach to this as I don't love the implementation I'm being asked to do (in this system if there is a customer price, it replaces ALL quantity breaks which to me is somewhat of a special case. Also in this case there is a break price but not a range making it effectively impossible to merge customer specific and generalized pricing breaks - again fine for this use case).

It seems to me a generalized solution would include a product identifier (ID, SKU, etc.), customer identifier, min qty, max qty and price per. You could then optionally set store rules about how to merge customer specific and general pricing, and you could still cover special cases like this project by setting the range from 1 to an arbitrarily high number where you wanted a given price to override general pricing.

Also, do you come across systems where it is a numeric or percentage discount for the ranges? Perhaps instead of a price, a "Number" and "Type" (price, discount percentage or discount amount) would give a little more flexiblity?

Any thoughts from anyone who has implemented a few more of these? I understand there is never a one true way, but I'm looking for a flexible data structure and algorithms with a few proeprty settings to cover the vast majority of small to mid sized business use cases.

Thoughts?

Related Blog Entries

Comments
Good luck :) Regardless of what you build the customer will come back shortly after implementing it and ask for another option that will be impossible to implement using your existing schema.

There are so many variables it's difficult to come up with something that covers everything... I would say numeric and percentage discounts are popular. I had a cart where depending on what you ordered (and how many) you would get something for free. Or if you bought a certain number you would get a percentage off the total, etc.
# Posted By Jim Priest | 5/3/07 8:36 AM
One gotcha I ran into is in how to deal with prices for additional options.

Lets say product A has an Option of 'red' which adds $10 to the price. Some customers would want the discount of 5% off to only cover the product and not the option as well. Others say both.

Something I have done in the past is:

ID - Type (percentage, numeric, volume purchase) - amount_applied - volume_size - apply_to_options

So any product can be associated with the id via join tbl and from that you know how to apply the discount and what type. The tricky part is if there are multiple discounts applied. Depending on how you order them you could get a different end result.
# Posted By Joshua Cyr | 5/3/07 8:48 AM
Hi Jim,

I know what you're saying :-> I'm lucky that by dealing with smaller clients and budgets aI can often "direct" them towards a more affordable (configuration based) solution. Also I handle those kind of discounts separately from price breaks. For me price breaks are only ased on quantity of a single item. I implement total order price or quantity breaks as universal discount codes and I'm working up a couple of other systems for package based ordering and 11 for the price of 10 style promotions. Gol is to have a bunch of types of discount engines with configurable rules over how they interact to create a fairly flexible total solution. We'll see :->
# Posted By Peter Bell | 5/3/07 8:56 AM
Hi Joshua,

Nice catch. Have you been holding out on me? Thought you mainly did cms's given your job. Didn't realize you also did commerce :-> I like the idea of the option to apply discounts just to base price or to attribute pricing if the discount is an amount off as opposed to a new price. Thanks!
# Posted By Peter Bell | 5/3/07 8:58 AM
Actually I hate ecommerce. Clients make it so painful and I dislike the liability potential. However client wants what client wants. :-) Just ask me how many little pet projects I have going on right now. I dare ya.
# Posted By Joshua Cyr | 5/3/07 9:08 AM
I hear ya. Gotta love clients. Oh how pretty our software would be if we didn't have to twist and mangle it to meet real business needs :-<

So, how many little pet projects have you going on right now? I know of a couple but won't name them just in case they are still under wraps :->
# Posted By Peter Bell | 5/3/07 9:18 AM
I'd suggest taking a look at the Apache Open For Biz project. I was digging through enterprise data modeling books to attack this exact problem and ended up finding the OFBiz project. They have crafted a solution based on best practice and from my experience, it can handle anything that a client has ever asked me for. It is based in Java, but the underlying concepts and data model are what have helped me build some extremely powerful solutions.
# Posted By Rich Kroll | 5/3/07 4:35 PM
Ha, this just came up for me a couple of days ago. Some of the marketing gals decided they were going to do a discount scheme, for wholesalers only, and only products in a specific category, a la "buy 5 to 10 items, get 15% off. Buy 11 to 15 items, get 20% off" etc. They were about to send out the big announcement newsletter when it crossed my desk. I had to inform them that I had to write some custom code, as our store didn't support that out of the box.

I was able to bang it out in a couple of hours, but needless to say it's completely outside our normal discounts scheme, which is coupon based - not exactly a reusable solution.

I don't know how you could ever anticipate every possible discount scheme. Once you think you have them all accounted for, someone will come up with something new.

I'm afraid this area is one of the gnarliest to deal with in ecommerce, so I don't have any great solutions for you. All I can say is good luck!!
# Posted By Josh Nathanson | 5/3/07 6:06 PM
Hi Rich,

Thanks for the heads up. Checking it out now. For anyone else interested, most information seems to be at http://ofbiz.apache.org/
# Posted By Peter Bell | 5/3/07 7:00 PM
Hi Josh, You're probably right, but I gotta keep the faith and see how much of this I can engineer into a set of reusable, configurable elements. The more I can do, the better!
# Posted By Peter Bell | 5/3/07 7:01 PM
Price Breaks are rather easy, here is a table design below.

PRODUCT_TBL
---------------------------
IDPK
SKU
....

PRICE_TBL
---------------------------
ID
PRODUCT_UID_FK
LISTPRICE

TIERPRICE_TBL
---------------------------
PRICE_UID_FK
QUANTITY
LISTPRICE


Above you have a product which has a price. The price can have 1 to n tierprices which should be looked up by the prices id and the quantity.

Josh Bouchair
# Posted By Josh Bouchair | 5/22/07 4:47 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.