Contents
On this page
Update Pricing Rule - Plugixa Car Rental
PUT /plugixa-car-rental/v1/pricing-rules/{id}
Change a pricing rule. Only the fields you send are changed; PATCH works the same way.
Needs Plugixa Car Rental Pro with the Pricing rules app on. The user needs the plugixa_car_rental_edit capability.
Note.
conditionsis replaced as a whole, not merged: a condition you leave out of the object is cleared. Send every condition the rule should keep.
Request
PUT https://your-site.example/wp-json/plugixa-car-rental/v1/pricing-rules/3
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The pricing rule’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | Must not be blank. Customers see it on the price line. Up to 100 characters. |
amount |
number |
No | For percent, -100 to 1000 and not 0 (15 adds 15%). For fixed, not 0: added to each day, negative to take off. For set, the day’s new price, not negative. Rounded to 2 decimals. |
adjustment |
string |
No | percent, fixed or set. |
priority |
integer |
No | 0 to 9999, lowest runs first. |
stop |
boolean |
No | Skip later rules on a day this one applies to. |
conditions |
object |
No | When the rule applies; every condition set must be true. Replaces the stored conditions as a whole. |
conditions.model_ids |
integer[] |
No | Only these vehicle models. Empty: all. |
conditions.location_ids |
integer[] |
No | Only rentals picked up at these locations. Empty: all. |
conditions.date_from |
string |
No | First day, YYYY-MM-DD. Each rental day is checked on its own. |
conditions.date_to |
string |
No | Last day, YYYY-MM-DD, on or after date_from. |
conditions.weekdays |
integer[] |
No | Days of the week, 1 Monday to 7 Sunday. Empty: every day. |
conditions.min_days |
integer |
No | Shortest rental, in days. 0 for no minimum. |
conditions.max_days |
integer |
No | Longest rental. 0 for no maximum, else at least min_days. |
conditions.min_lead_days |
integer |
No | Booked at least this many days before pickup. 0 for no minimum. |
conditions.max_lead_days |
integer |
No | Booked at most this many days before pickup. 0 for no maximum, else at least min_lead_days. |
status |
string |
No | published or unpublished. |
modified_at |
string |
No | The modified_at you read. When it differs from the stored one the update is refused with 409. See Edit conflicts. |
Fields you leave out keep their stored value. The whole rule, as it would be after the change, is checked again.
{
"conditions": {
"location_ids": [
1,
2
],
"weekdays": [
6,
7
]
},
"modified_at": "2026-11-12 09:30:00"
}
Responses
200 OK. data is the pricing rule as it now is.
{
"success": true,
"data": {
"id": 3,
"name": "Weekend in Paris",
"priority": 10,
"adjustment": "percent",
"amount": 15.0,
"stop": false,
"conditions": {
"model_ids": [],
"location_ids": [
1,
2
],
"date_from": "",
"date_to": "",
"weekdays": [
6,
7
],
"min_days": 0,
"max_days": 0,
"min_lead_days": 0,
"max_lead_days": 0
},
"status": "published",
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 10:15:00",
"deleted_at": null
}
}
| Field | Type | Meaning |
|---|---|---|
data.conditions |
object |
When the rule applies. See the request body |
data.modified_at |
string |
UTC datetime of this change |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_car_rental_not_found |
No pricing rule with that id, or it is in the trash. |
422 |
plugixa_car_rental_invalid |
name is blank, amount does not suit adjustment, a date or day range in conditions is the wrong way round, or conditions names a model or location that does not exist. data.field names the field, for example conditions.date_to. |
422 |
plugixa_car_rental_invalid_choice |
status or adjustment is not one of its values. data.allowed lists them. |
422 |
plugixa_car_rental_not_a_number |
A number field was sent as something else. data.field names it. |
422 |
plugixa_car_rental_negative_number |
priority is negative. |
422 |
plugixa_car_rental_too_long |
A text field is longer than its column. data.field names it and data.max gives the limit. |
409 |
plugixa_car_rental_conflict |
You sent modified_at and the pricing rule has been saved by someone else since. data.expected and data.current carry both values. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-car-rental/v1/pricing-rules/3" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"conditions":{"location_ids":[1,2],"weekdays":[6,7]},"modified_at":"2026-11-12 09:30:00"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/pricing-rules/3');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'conditions' => [
'location_ids' => [1, 2],
'weekdays' => [6, 7],
],
'modified_at' => '2026-11-12 09:30:00',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-car-rental/v1/pricing-rules/3', {
method: 'PUT',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
conditions: { location_ids: [1, 2], weekdays: [6, 7] },
modified_at: '2026-11-12 09:30:00',
}),
});
const { data } = await response.json();
Quick Links
Share