# Rule: Match Quantity

Customers often have the need to have one product quantity match a base product quantity in a checkout flow. It's not enough to assume the customer will select the same quantity for each, so we create a rule to enforce the same quantity.

For example, if you are subscribing to the Premium Plan and have 5 licenses, then you must also choose the Premium Support Plan and 5 licenses.

We introduce the 'Match Quantity' rule:

The first branch of the rule is the initial base product. You need to enter the Id of the base product.&#x20;

```
IF Product1.Id = 66, AND
```

&#x20;The second branch also applies to the base product and is to specify that if it is selected, then perform the match function.

```
Product1.Id = 66 IS SELECTED, AND
```

The third branch is for the related dependent product. If the base product is selected, and the quantities are not the same, then match quantities.

```
Product2.Id = 73 AND


Product1.Quantity IS NOT EQUAL TO Product2.Quantity


THEN, MATCH QUANTITIES
```

In order to match quantities for each product, you will need to create a similar rule for each product dependency.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.peakcommerce.com/developers/logic-and-rules/rule-match-quantity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
