Wix booking custom pricing

Question:
How to add custom pricing based on specific dates
Product:
Wix Editor
What are you trying to achieve:
adjust booking prices based on time frame for example from may 1st to July 1st price is $100 and then from July 1st to Oct 1st price is $150.

What have you already tried:
I tried to look for custom code but i dont understand anything

Additional information:
Custom pricing is a major part of what im selling because it all depends on the date. I dont see any way of doing it through the services section. Im feel crippled and need help

1 Like

Custom pricing logic can be implemented using Velo code. This tutorial shows you how:

If you’re not familiar with writing code, then I would suggest hiring a developer to build this for you on your website.

1 Like

how to hire someone ?

1 Like

You can hire a developer from the Marketplace, or if you want us to develop this for you, please reach out via our website by clicking on the button below. We’re Wix Certified Velo Developers and specialise in developing custom code solutions just like this. (:

Get in touch

1 Like

i got the function to work locally in the fucntion output but when i go and publish it doesnt reflect when i go look into the wix logs i only see this Your site was published with an update to the bookings pricing provider
integration, ‘pricecustom’ . The price is set to Fixed in my service is that why ?

1 Like

It’s hard to tell what’s causing this without taking a look at your site and the code you’ve written. It could either be your frontend code, or the Service Plugin which might not be working as expected.

1 Like

my config.js has this code // No imports needed for config

export function getConfig() {
  return {
    pricingProviderName: "calculatePrice" // Must match your function name
  };
}

then my .js has this

// datepackage.js (Final Production Version)
export const calculatePrice = async (options) => {
  try {
    // Validate input
    if (!options?.booking?.startDate) {
      console.error("Missing booking data");
      return { calculatedPrice: 1062 }; // Winter default
    }

    // Calculate season
    const month = new Date(options.booking.startDate).getMonth() + 1;
    const isSummer = month >= 5 && month <= 8;
    
    // Debug log for live testing
    console.log("Live price calculation:", {
      date: options.booking.startDate,
      month,
      season: isSummer ? "summer" : "winter",
      price: isSummer ? 897 : 1062
    });

    return {
      calculatedPrice: isSummer ? 897 : 1062,
      _metadata: { refreshCheckout: true } // Force UI update
    };

  } catch (error) {
    return { calculatedPrice: 1062 }; // Fail-safe
  }
};
1 Like

Yes, this code is pretty much correct and should update the price at checkout, so you won’t need this line:

However, do note that this code will run for ALL your services and will change the price of all of them during checkout. So if you need different pricing for specific tours, you’ll need to perform additional checks to fetch the booked tour and update the price accordingly.

And again, this will not update on the site’s frontend. The price will still be what you have set to default when the user browses through your tour packages. This code will only run and update the price when the user actually proceeds to book by clicking on the Book Now button.

1 Like

Hey Pratham, thank you for your last response, I was going crazy about it, because my price didn’t update in the frontend before clicking on the Book Now button and cause I didn’t deploy to live of course I could also not see the effect and thought my code was not working.

Do you have any helpful insights how to implement the UI update logic, ideally every time a field changes?

1 Like

You’re welcome!

Unfortunately as far as I know, the price on the UI will not update dynamically when using the Wix Bookings widgets, for that you will need to develop a completely custom booking flow, similar to the one shown in the tutorial video above.

1 Like