> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: calculatePrice(options: Options, context: Context) # Method package: wixBookings # Method menu location: wixBookings --> BookingsCustomPricing --> calculatePrice # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/bookings/service-plugins-spis/bookings-custom-pricing/calculate-price.md # Method Description: Calculates the price of a booking to include during checkout. The calculated price is based on custom business logic. The `calculatePrice()` function calculates custom pricing for use on the checkout pages of a merchant's site. The function is automatically called by Wix when the booking is being checked out for payment. ### Where to find `calculatePrice()` When you [add the Custom Pricing plugin](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-bookings/tutorial-bookings-pricing-custom-extension.md#step-1-create-a-bookings-pricing-extension), a folder is automatically added to your site. Use the `.js` file in the folder to write the code to calculate the price for the booking. For more information on customizing your price calculation, see [Tutorial: Bookings Pricing Custom Extension](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-bookings/tutorial-bookings-pricing-custom-extension.md#js). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Calculate a custom price for a booking ```javascript // Import "coded-elsewhere" functionality for retrieving special rates import { getPrices } from 'backend/queries'; // The calculatePrice service plugin runs at checkout to calculate the final price export const calculatePrice = async (options) => { const prices = getPrices(); const additionalFields = options.booking.additionalFields; const numberOfParticipants = options.booking.numberOfParticipants; const weekendRate = getFieldValue(additionalFields, "weekendRate"); const addon1Value = getFieldValue(additionalFields, "Addon 1"); const addon2Value = getFieldValue(additionalFields, "Addon 2"); const addon3Value = getFieldValue(additionalFields, "Addon 3"); const rate = weekendRate == "true" ? prices.weekend : prices.weekday; const finalPrice = numberOfParticipants * rate + addon1Value * prices.addon1 + addon2Value * prices.addon2 + addon3Value * prices.addon3 ; return {calculatedPrice: finalPrice}; }; // Retrieve the charge for each given `additionalField` for the booking. export function getFieldValue(additionalFields, text) { const foundFieldArray = additionalFields.filter(additionalField => additionalField.label === text); return foundFieldArray.length === 0 ? undefined : foundFieldArray[0].value; } ``` ---