Prevent product purchases if a booking is shorter than a set amount of time
  • 14 Mar 2024
  • 1 Minute to read

Prevent product purchases if a booking is shorter than a set amount of time


Article Summary

This rule prevents the purchase of a specific product alongside a booking if the booking is shorter than a minimum duration you define.

For example, customers booking any resource for less than 2 hours cannot purchase the catering service that you sell as a product alongside the resource.

You need the following details to set up this rule:

  • The ID of the product that can't be purchased if bookings are too short.
Don't know where to get this ID?

  1. Log in to dashboard.nexudus.com if you aren't already.

  2. Click Add rule

  3. Click on Manual entry

  4. Name your validation rule.

  5. Add a Description for your rule to let other admins know what it does at a glance.

  6. Toggle on This rule is active.

  7. Select Bookings in the Record type.

  8. Add the Error message to display if the validation rule is not met.

  9. Add the following code snippet to the Formula field.

(record.GetLengthInMinutes() >= MINUTES) OR (HasProduct(record, PRODUCT_ID) = false)
  1. Replace MINUTES in the formula with the minimum booking length to allow the purchase of the selected product.
The minimum booking length is always defined in minutes.

In the example below we used 2 hours or 120 minutes.

(record.GetLengthInMinutes() >= 120) OR (HasProduct(record, PRODUCT_ID) = false)

  1. Replace PRODUCT_ID in the formula with the ID of the product that can't be purchased if bookings don't meet the mimimum length defined in the previous step.

In the example below, the product ID is 123456789.

(record.GetLengthInMinutes() >= 120) OR (HasProduct(record, 123456789) = false)

  1. Click the Save Changes button.


All done! We recommend trying to purchase the selected product alongside a booking that is shorter than the minimum booking duration you defined. If you see your error message displayed as you try to check out, you're good to go.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.