> For the complete documentation index, see [llms.txt](https://magecomp.gitbook.io/shopify/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://magecomp.gitbook.io/shopify/apps/skelta-buy-x-restrict-y/collections.md).

# Collections

If you want to create restrictions on collections, perform the following steps.

<mark style="color:blue;">**Step #1**</mark>

Go to **Dashboard** <mark style="color:blue;">➤</mark> **Collections**

<mark style="color:blue;">**Step #2**</mark>

Select the  **Create Collection Rule** button to add the collections you want to create restrictions for.&#x20;

<figure><img src="/files/nVKgw4aH2lvQfuTtwqlJ" alt=""><figcaption></figcaption></figure>

Use **Collection Dependency** rules when certain collections must be purchased together. If a customer adds a product from the primary collection to their cart, products from the required target collections must also be included.

### 1. Select Rule Type

Choose how the collections should interact:

#### **Restriction**

Products from the selected collections **cannot be purchased together**. If a customer adds one collection's product to the cart, products from the restricted collection cannot be added.

#### **Dependency**

Products from the selected collections **must be purchased together**. If a customer adds a product from the primary collection, products from the target collections become required.

{% hint style="info" %}
**Example:** If "Coffee Machines" is the primary collection and "Coffee Pods" is the target collection, customers purchasing a coffee machine must also purchase coffee pods.
{% endhint %}

<figure><img src="/files/Y36EGNGZMu0TL54Km6mP" alt=""><figcaption></figcaption></figure>

### 2. Primary Collection

Select the main collection that triggers the rule.

* Click **Select Collection**.
* Choose the collection that should activate the dependency or restriction rule.
* When a customer adds a product from this collection to their cart, the rule will be applied.

{% hint style="info" %}
**Example:** Select **Laptop** as the primary collection.
{% endhint %}

<figure><img src="/files/QEwdL2z0Uaf9aQS8RwQ9" alt=""><figcaption></figcaption></figure>

### 3. Target Collections

Select one or more collections that will be linked to the primary collection.

* Click **Select Collections**.
* Choose the collections that are required (for Dependency) or restricted (for Restriction).
* Multiple collections can be selected.

{% hint style="info" %}
**Example:** If **Laptop** is the primary collection and **Laptop Bag** and **Mouse** are target collections, customers must also purchase products from these collections when buying a laptop.
{% endhint %}

<figure><img src="/files/aAhrYtQBsNrNmWjUjqHa" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://magecomp.gitbook.io/shopify/apps/skelta-buy-x-restrict-y/collections.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
