Dynamic pricing in Woo

I have been asked to quote for changes to an existing woocommerce site.
The client wants the product price to change depending on delivery location. Not the delivery charge, delivery is included in the order price. Quantity prices are currently handled as variations
I have looked through loads of plugins and can’t find any that does this.
Am I missing something or is this into custom plugin territory.

3 Likes

I’m trying to imagine how the product price will change. Doesn’t a fixed price need to be displayed in the shop? It would seem odd to put something in the cart at one price, enter my address, then go to pay and find the product price has jumped higher.

Are the prices all going up by the same amount? ie a set surcharge amount or percentage?

1 Like

I don’t know where @Mark is but, in some online stores in the US, there won’t be any prices quoted until the customer provides his/her zip code.

I have to say that I hate stores like that! I have always thought it makes more sense either to add delivery separately or to add a delivery surcharge for customers in certain locations. But at least show me the product price to begin with! (Sorry, Mark, I know it’s not your choice!)

3 Likes

Yes, I don’t know the situation but it seems a little dodgy to me. “FREE SHIPPING! (except we will adjust the price according to where you live)”.

Anyway, if you can provide some more details we can probably come up with a code snippet to do the job.

Some variation of this should do it - just need to increase the price instead of discount, and check for location, not quantity: https://classiccommerce.cc/docs/snippets/set-discount-for-bulk-buying/

1 Like

Thank you for the replies. It is for heating oil the price varies depending on quantity selected.
The client is expanding (their business) and as the pricing is competitive the further from the depot the higher the delivery. In a small form on home page. client selects town/village in one options box and number of litres required in another to get the oil quote before being passed to the order page.
So product price is up-front, no discounts no separate addon delivery charges. All clean (except perhaps carbon footprint :slight_smile: ) and above board.
In woo the prices for different quantities are set up as variations (like you might do different colours of tshirts.
If delivery was only in one fixed quantity each village/town could be a variation, that would not be a problem.
If woo can do two independent variations both of which affect price that might be an option.

Just thinking about it each area with a different price will multiply the amount of updates to prices needed. Ten areas and ten possible delivery quantities = 100 prices to enter. Not too much trouble for tshirts but when the last troubles hit the Middle East Oil prices were changing twice a day. But that would be the clients problem not mine :slight_smile:

I was also thinking of a multiplier on a base price, but the prices do not vary in a linear way.
I don’t do their price calculations but it is approx. delivery + quantity*price/litre but not quite

2 Likes

Are they inter-related? So, does the quantity discount also depend on location?

You can easily do the quantity discount with that code snippet above - no need for variations. Then you could adjust the price from the cart according to location after they enter their address. But if the amount depends on both quantity and location together then it is getting more complicated.

And if you are collecting the location and quantity on a separate form then passing them to Woo it is also getting more complicated again. Anyway, I doubt you will find a plugin to do this. Sounds like a custom coding job.

Two resources to check out:

These are starting points. The actual solution might require custom coding.

Partly the problem isn’t about updating the price but rather figuring out the distance from the depot to customer, and then figuring out how to charge appropriately based on that distance. Might need to use Google Maps API to calculate distance.

One more thing. Woo might not be the best solution for this. It might be better to use form plugin like Gravity Forms with payment gateway. User enters address, form calculates distance and price, then user checkout by making a payment.

4 Likes

I agree with this. Could you do per litre price multiplied by a percentage that takes into account the distance from the depot? The multiplier won’t change, so you’ll only have to set it once for each distance calculation. Then the client only needs to change the price as the market changes.

So its more like a price calculator than a fixed shop, isnt it?

I’ve build something like this using several custom plugins, but there is also a (freely available) plugin that does this, too. The bad thing about this plugin is: It takes ages to load and the calculation process cannot be called “quick” and “nimble”, either.

We solved this situation using a custom system, which stores the three to four different types of heating oil in a custom post type, with a few meta fields (think: ACF Pro), and I built about 2/3 of a calculator / order process for this. Nearly at the end of the job, the client wanted to do it differently again, but as I just was hired as a sub-contractor, the main contractor took my work and rebuilt parts of it instead.

About the calculator / order process itself:

The client had originally two price lists for specific postcode regions, that included a slow lowering of the price per liter, based on the amount to be delivered. But of corpse, different pricings per list. So one list was for the region nearby, which was about 1 - 2 cents lower per liter, and the rest was for the outer region. Think of table rate-based shipping, but per specific liter amount.

I’ve first converted this into CSV and directly used it within calculation process, just to have actual numbers to work with, which I later on converted into ACF Options fields, so essentially a repeater field with several sub fields; then I built a custom import tool, because most CSV Import tools seem to struggle getting the ACF meta structure right … whyever that is. It’s is certainly decently programmable = automation is not that big of an issue. My guess is its probably something peer group-related = programmers dont want to implement the functionality, as long as not enough cutomers have complained about this (ie. a missing feature).

So yes, this totally IS custom plugin territory.

cu, w0lf.

1 Like

Yes that would seem to be a possible solution.
Currently they have a spread sheet that calculates the specific “price” for quantity and location ,for base oil cost, and they then manually put these prices in to several websites.
Ok for a few areas /amounts, but tedious and error prone for multiple regions

So the site just needs to use whatever formula this spreadsheet is using.

1 Like

A cell for each quantity and location, each with its own formula. Sounds easy but does that not take us back to the problem of passing a value from the database to the form on the website.

1 Like

Yes, the way I described it this would be a custom coding job.