# Rule: Enforce Product Quantity

### Overview

It's common to impose minimum quantity requirements on certain available plans, often in conjunction with bundles. Within the PeakCommerce rules engine, you have the ability to establish product dependency rules and minimums for specific products.

### Example

Netflix serves as a straightforward illustration of the minimum license rule. Their plans typically combined streaming access with a set number of DVDs per month for a fee. For instance, opting for 5 DVDs was cheaper than selecting 10 DVDs, and so forth.

Consider the bundled plan offering streaming along with 5 DVDs at a time. Notably, Netflix often imposed additional restrictions, such as limiting access to 5 family members. This particular plan might have been termed the '5 Family Plan' or similar.

If a quantity of 5 is chosen for the first product, streaming, behind the scenes, the add-on of 5 DVDs must also be set to a quantity of 5.

To trigger this rule, set the event on the rule set to **Quantity Changed**.

The pseudocode is:

{% code lineNumbers="true" %}

```
If
  Id = _____ ( or Name = ____ )

And
  Second Id = ______ (or Second.Name = _____ ) 

And
  Q1 = 5 And Q2 = 5

THEN
  Match Quantity
```

{% endcode %}

{% hint style="info" %}
&#x20;Note: Each and should be in a different tier. Logic checks tiers in reverse order on the backend
{% endhint %}


---

# 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-enforce-product-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.
