# Price rules: table and adjustment by region or by seller

> For the administrator: create price rules by region or by seller portfolio, with a table or a percentage adjustment, and learn which rule wins.

Source: https://vendria.com/en/ajuda/regras-de-preco

## Where to find it

In your account menu, under **Prices**, **Price tables** tab, in the **Price Rules** card,
below the list of tables. The rules belong to the store chosen in the selector at the top of the
screen.

## What price rules are for

A price rule says "this group of customers uses this table" (or "pays X%
more or less") without you having to open each customer's profile. A single row
reaches:

- **all customers in a region** (e.g. every customer in ES uses the "ES -
  ICMS 7%" table); or
- **a seller's whole portfolio** (e.g. João's customers use the
  "Wholesale" table).

The rule can do one of three things: **change the table**, **adjust the price**
by a percentage, or **both**.

⚠️ Price rules depend on the condition-based pricing engine, which Vendria
enables store by store. Where it isn't active yet, the rule is saved but doesn't
change any price. If you created a rule and the price didn't change, check with
Vendria support.

## How to create a price rule

1. In **The rule applies to**, choose **Customer region** or **A seller's
   portfolio**.
2. Fill in the scope:
   - **Customer region (state)**: the two-letter state code (e.g. ES);
   - or **Seller**: choose in **— choose the seller —**.
3. Say what the rule does, at least one of the two:
   - **Use the table**: the table the group starts using, or **— keep the
     current one —**;
   - **and/or adjust**: a percentage, positive or negative (e.g. +5 or -3),
     between -90% and +100%.
4. If the rule has a time window, fill in **From (optional)** and **To (optional)**. "Until"
   includes the whole day.
5. Click **Create rule**. The message **Rule created.** confirms it.

The button is only enabled with the scope filled in and at least the table or the
adjustment.

## Which rule wins when several apply

The order for choosing the customer's price is:

1. the table chosen on the **customer profile**: it beats any rule;
2. the rule for the **portfolio of the seller** who owns the customer;
3. the rule for the customer's **region**;
4. the store's **default table**.

In other words: "João sells with table X" applies wherever the customer is, but
a customer with a negotiated table on the profile doesn't lose it by changing sellers.

The rule's seller is always the **portfolio owner** of the customer, not whoever is
serving them at that moment. That's why the price is the same when the seller builds the
quote and when the buyer orders through the catalog.

## The percentage adjustment

The adjustment is applied **last**, on top of the winning price: the table's, or the
promotion's, when it applies. An adjustment-only rule (no table) doesn't change the
customer's table: it adjusts the price the normal choice would give.

When two rules apply (for example, a seller rule with only an adjustment and a
region rule with a table), the table comes from the region rule and the adjustment comes from the more
specific one, the seller's.

In the list, the rule appears as "+5% on the current price", next to the table's
name, when there is one.

## Where the customer's region comes from

A rule's region is always **the customer's**, in this order:

1. the **Price region** field on the customer profile (**Details** tab), when
   filled in;
2. the area of the seller who owns the portfolio, when the seller has one registered;
3. the UF of the customer's registered address.

When **Price region** is empty, the profile shows the value deduced from the
address, for example "ES (from address)". ⚠️ That value looks **only at the address**:
if the portfolio's seller has a registered area, the area decides the price,
even with the profile showing the address's UF. Consequence: without the field filled in, moving the
customer to another seller may change their region, and the price. Fill in **Price
region** to pin it.

## The list of rules

Rules appear grouped by what they do: eleven UFs pointing to the same
adjustment become a single row, with one tag per UF. Each row shows the type of
scope (**Region**, **Seller**, **Customer** or **Whole store**), the tags,
the **→** arrow, what the rule does and the period.

The row's trash icon deletes **all** the rules in the group, after confirming
("Delete the N rules (...)?"). There is no editing: to change a rule, delete it and create
it again.

## Rules that come from the ERP

A row with the **from the ERP** badge is the percentage your ERP declares for that
customer. It appears here only as a mirror:

- deleting asks for its own confirmation, because the rule **comes back on its own** at the
  next reading of the customer, and until then the customer is quoted at the base price, without
  their adjustment;
- to really change it, change the percentage in the ERP.

## When it goes wrong

**"A price rule with this same scope and an overlapping period already exists."**
There's another rule for the same region or seller valid in the same period. Delete the
old one or adjust the dates.

**"A rule cannot point to a promotional table."** The promotion applies
on its own; choose a commercial table in **Use the table**.

**"The adjustment must be between -90% and +100%."** Fix the percentage.

**"I created the region rule and a customer from that UF didn't change price."** They have a
table chosen on the profile, belong to a seller with their own rule, or their **Price
region** points to another region.
