Owner: Dev Team | Last Updated: 2026-02-21 | Status: Current
Setting up automatic pricing rules to manage prices based on conditions.
Dynamic Pricing allows you to automatically adjust Experience prices based on rules and conditions: time until the event, day of the week, occupancy rate, and other factors.
PricingRule
└── RuleCondition (1:N)
└── condition_type + operator + value → price_adjustment
PRuleAssign (date range + recurrence pattern)
└── PRuleCondition (1:N)
└── pricing_rule_id + min_price + max_price + priority
└── PRulePattern (recurrence)
└── Experience (M:N via XpPRuleAssign)
A Rule (PricingRule) is a named set of conditions:
| Field | Type | Description |
|---|---|---|
name |
string | Rule name |
status |
boolean | Active / Inactive |
Each rule contains one or more conditions (RuleCondition):
| Field | Type | Description |
|---|---|---|
condition_type |
string | Condition type |
operator |
string | Comparison operator |
value |
json | Value for comparison |
price_adjustment |
decimal | Adjustment amount |
type_adjustment |
string | Type: percentage / flat_rate |
| Type | Constant | Description |
|---|---|---|
| Time Until Event | TYPE_TIME_UNTIL_EVENT |
Time until event start |
| Day of Week | TYPE_DAY_OF_WEEK |
Day of the week |
| Operator | Constant | Example |
|---|---|---|
| Equals | OPERATOR_EQUALS |
Day = Monday |
| Less Than | OPERATOR_LESS_THAN |
Hours < 24 |
| Greater Than | OPERATOR_GREATER_THAN |
Hours > 48 |
| In | OPERATOR_IN |
Day IN [Sat, Sun] |
| Not In | OPERATOR_NOT_IN |
Day NOT IN [Mon, Tue] |
| Type | Constant | Example |
|---|---|---|
| Percentage | TYPE_ADJUSTMENT_PERCENTAGE |
+10% (surge) or -15% (discount) |
| Flat Rate | TYPE_ADJUSTMENT_FLAT_RATE |
+$5 or -$10 |
PRuleAssign links rules to Experiences for a specific period:
| Field | Type | Description |
|---|---|---|
start_date |
date | Effective start date |
end_date |
date | Effective end date |
is_recurring |
boolean | Recurring rule |
For recurring rules:
| Field | Type | Description |
|---|---|---|
recurrence |
string | Recurrence type |
frequency |
string | Frequency |
weeks |
json | Weeks (array) |
days |
json | Days (array) |
Additional constraints for assignments:
| Field | Type | Description |
|---|---|---|
pricing_rule_id |
integer | Link to PricingRule |
min_price |
decimal | Minimum price (floor) |
max_price |
decimal | Maximum price (ceiling) |
notify |
boolean | Notify when triggered |
priority |
integer | Priority (higher = more important) |
1. Get base price for Experience ticket type
2. Find active PRuleAssign for current date
3. Filter by recurring pattern (if applicable)
4. Sort conditions by priority
5. For each condition:
a. Evaluate RuleCondition.checkCondition(currentValue)
b. If matches → apply getPriceAdjustment()
c. Clamp result between min_price and max_price
6. Return adjusted price
File: app/Services/DynamicPricingService.php
PricingRule: "Weekend Surge +15%"
└── RuleCondition:
condition_type: TYPE_DAY_OF_WEEK
operator: OPERATOR_IN
value: ["Saturday", "Sunday"]
price_adjustment: 15
type_adjustment: TYPE_ADJUSTMENT_PERCENTAGE
PRuleAssign:
start_date: 2026-06-01
end_date: 2026-09-30
is_recurring: false
└── PRuleCondition:
pricing_rule_id: (above rule)
min_price: 20.00
max_price: 200.00
priority: 1
└── Experiences: [Sunset Cruise, Harbor Tour]
| File | Purpose |
|---|---|
app/Models/PricingRule.php |
Rule model |
app/Models/RuleCondition.php |
Condition model |
app/Models/PRuleAssign.php |
Rule assignment |
app/Models/PRuleCondition.php |
Assignment condition |
app/Models/PRulePattern.php |
Recurrence pattern |
app/Models/XpPRuleAssign.php |
Pivot: Experience ↔ Assignment |
app/Services/DynamicPricingService.php |
Calculation logic |
app/Http/Controllers/Web/PricingRuleController.php |
Controller |
resources/js/pages/dynamicPricing/ |
Frontend pages |
| Date | Author | Change |
|---|---|---|
| 2026-02-21 | Documentation Team | Initial creation |
Up: Guides