> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pcnaid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure sorting rules

> Create a sorting rule to automatically reorder a collection by availability, metafields, or advanced signals.

# Configure sorting rules

## What does this do for me?

A sorting rule automatically reorders one collection in the background, so you do not have to drag products around manually. The app moves out-of-stock items to the bottom and can pin selected products to the top.

## 1. Open Sorting Rules

From the Home screen, select **Sorting Rules**, then select **Create rule**.

The **Sorting Rules** page shows a **Rule allowance** badge that counts enabled rules against your plan, and a table with **Collection**, **Status**, **OOS**, **Metafield sort**, **Frequency**, **Last job**, and **Actions** columns.

## 2. Choose the collection

Under **Collection**:

* Use **Search collections** to find a collection.
* Select a collection from the **Collection** dropdown, or enter a **Manual collection ID or GID**.
* Optionally list **Excluded products (comma-separated IDs)** to skip specific products.
* Optionally list **Pinned products (comma-separated IDs)**; pinned products stay at the top of the collection.
* Optionally enter **Segment weights** as a JSON map of segment codes to multipliers, such as `{"US": 1.5, "EU": 1.2}`. Leave blank to apply no segment weighting.

Collections must use the **Manually** sort order for the app to reorder them. The first rule run switches the collection for you.

## 3. Choose how to sort

Under **Sorting**:

* Turn on **Push out-of-stock products to bottom**.
* Choose a **Sort algorithm**. The **Basic (manual / original order)** option is available on every plan. Advanced algorithms (Inventory level, Freshness, Profit margin, Sell-through, Revenue, Conversion rate, and GA4 analytics) are labeled with the plan that unlocks them.
* Turn on **Enable secondary sorting by metafield** and set the **Metafield namespace**, **Metafield key**, and **Metafield type** (**Integer** or **Decimal**) to sort by a product metafield.
* Choose a **Sort direction**: **Descending (highest first)** or **Ascending (lowest first)**.

## 4. Choose the schedule

Under **Schedule**, set **Run frequency**:

* **On change (webhook)** runs the rule when Shopify reports product or inventory changes and when you select **Run**.
* **Hourly** and **Daily** require the Pro plan and run automatically on that cadence.

## 5. Save and run the rule

Select **Save** to create the rule. The rule appears in the table. Use the row actions to **Enable** or **Disable** the rule, **Run** it now, or **Delete** it. When a run finishes you can open **View details** on a failed job for an explanation and a **Retry rule** action. Deleting a rule keeps the current product order; only the automatic rule is removed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.