# Product listing

{% tabs %}
{% tab title="Grid" %}

<figure><img src="/files/VKyAU39Dd8aZcXZ5VBZI" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="List" %}

<figure><img src="/files/TePdOyO0jZVjuaHycRc7" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Showing a list of products based on a category in a grid or list view.

{% hint style="success" %}
Steps

1. In the theme editor (**Customize**), open the template selector
2. Select **Collections**, then **Default collection.**
3. On the left-sidebar, add **Product listing.**
4. Make necessary changes **> Save.**
   {% endhint %}

## Layout

* Control the listing's container type and layout.
* Show the number of products per row and per page.
* Enable/disable box layout.

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

* Show layout the columns switcher.

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

## Sorting and filtering

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

Enable/disable filtering and sorting by options.&#x20;

* Enable sorting

{% hint style="info" %}
See [how to change the default sort order of a collection here](https://help.shopify.com/en/manual/products/collections/collection-layout#change-the-sort-order-for-the-products-in-a-collection).
{% endhint %}

* Enable filtering: Enable Storefront filters for your store.

{% hint style="info" %}
Customize the filters in your store with the [Shopify Search & Discovery](https://apps.shopify.com/search-and-discovery) app.
{% endhint %}

{% hint style="warning" %}
Considerations for adding filters:&#x20;

* Collections that contain more than 5,000 products don't display filters.
* A filter can display a maximum of 100 filter values on your store.
* In the Shopify Search & Discovery app, a filter displays a maximum of 1,000 filter values.
* Translations aren't supported for the **Vendor** and **Tags** filter values. The product tag filter only displays to customers shopping in your store's default language. Vendor filter values are always based on your store's default language.
* The price filter doesn't display for currencies other than your shop's default currency.

[Learn more](https://help.shopify.com/en/manual/online-store/search-and-discovery/filters?q=What+are+the+limitations+of+using+filters+in+Shopify%3F).
{% endhint %}

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

You can also change the filter's position, title, and height.

### Pagination

<figure><img src="/files/47T9i46KyqFrQ4lx1hON" alt=""><figcaption></figcaption></figure>

Enable pagination in 3 ways.

{% tabs %}
{% tab title="Paging by numbers" %}
![](/files/WZXC09OLpEbB1NM9wx44)
{% endtab %}

{% tab title="Load more button" %}
![](/files/zIDcEGEnDlRgvZvBQdQw)
{% endtab %}

{% tab title="Infinite scroll" %}
![](/files/6Crp4jbWMUOMlU5Byv6o)
{% endtab %}
{% endtabs %}

### Storefront filters settings

This setting is for storefront filters only. You can enable changing product card variants on filtering and showing results count on filter items.

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

### **How to create a visual filter**

Filter values can include visual elements such as colors, patterns, or other creative imagery.

For example, a *Fabric color* filter can display a small color swatch for each filter value.

To create visuals with your filter values, set up custom data for your store with [metafields](https://help.shopify.com/en/manual/custom-data/metafields/metafield-definitions/creating-custom-metafield-definitions) and [metaobjects](https://help.shopify.com/en/manual/custom-data/metaobjects/using-metaobjects). You also need to meet the [requirements](https://help.shopify.com/en/manual/online-store/search-and-discovery/filters#visual-filters).

{% hint style="info" %}
Product variant filters will link to more relevant variants on search results and collection pages.
{% endhint %}

#### **Now we will start from scratch by defining the** [**metaobjects**](https://help.shopify.com/en/manual/custom-data/metaobjects/using-metaobjects)**:**

1. Go to **Settings** > **Custom data** > Find the **Metaobject definitions** field > Click **Add definition.**

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FXl1bKmZf3sTUWmlA49N3%252Fimage.png%3Falt%3Dmedia%26token%3D2e3613f6-1d1e-42af-a56f-f22f6ee6d17d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=73155a67&#x26;sv=1" alt=""><figcaption></figcaption></figure>

2. In the **Add metaobject definition** page, give this metaobject a **Name** (Color) and 3 **Fields:**

* **Single line text** - For the color name (Name).
* **Color** - For the hex code of the actual color (Hexcode).
* **File** - For the image of this color (Image).

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FvgnsC2mMyIFteLhBEjMn%252Fimage.png%3Falt%3Dmedia%26token%3D15e27530-3717-4a9b-a30a-25449fb49ba6&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=24add199&#x26;sv=1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A metaobject definition for a color swatch should have both a color and an image field.

You don't need to provide a value for both, but this will give you the option of using either field in the future.
{% endhint %}

3. Click **Save**.

#### **Next step, we will create the colors list:**

1. In the Shopify admin sidebar, go to the **Content** > **Metaobjects** > In the **Metaobjects** page, select **Color**.

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FDwu7v8WHSNbNXExzQjpv%252Fimage.png%3Falt%3Dmedia%26token%3D349486b2-a9ad-4473-bf1f-6e2c3e0083c5&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=4ea98354&#x26;sv=1" alt=""><figcaption></figcaption></figure>

2. Click the **Add entry** button to add a new color. Give the color entry the Name, Color, and Image.

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FsX3nteV82dSVg7D1E1oS%252Fimage.png%3Falt%3Dmedia%26token%3D43b953f9-9b01-4e85-b6a5-9d75debdda36&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=a1feebcc&#x26;sv=1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note**: You can add many color entries and assign these colors to the products.
{% endhint %}

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FKYH0Bqzu08E1GsjLIgBx%252Fimage.png%3Falt%3Dmedia%26token%3D9145051e-0285-40b3-98f7-655660b03c2d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=bab4ffaa&#x26;sv=1" alt=""><figcaption></figcaption></figure>

3. Click **Save**.

#### **After that, we are going to create color** [**metafields**](https://help.shopify.com/en/manual/custom-data/metafields/metafield-definitions/creating-custom-metafield-definitions) **for the products to link to these** [**metaobjects**](https://help.shopify.com/en/manual/custom-data/metaobjects/using-metaobjects) **that we've just created above:**

1. Go to **Settings** > **Custom data** > In the **Metafield definitions** field, select **Products** > Click **Add definition.**

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252F12xUDgDUc9VzKiZKPQDb%252Fimage.png%3Falt%3Dmedia%26token%3Dc326d33b-0802-4864-bc1c-dfd748f07f8e&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=701a6d72&#x26;sv=1" alt=""><figcaption></figcaption></figure>

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

2. We will define this metafield as **Name**: "Color filter swatch" and **Type**: "Metaobject". In the **Reference** field, select the metaobject you want or you've just created (Color).

{% hint style="info" %}
If your products/ variants have multiple colors you could filter, set your metafield definition to allow a **List of entries**.

This lets you assign multiple metaobject entries to a single item and each one will display as a filter value on your store.
{% endhint %}

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FRfHXIehgwqZu7sQx4J6q%252Fimage.png%3Falt%3Dmedia%26token%3D85db905d-d185-4e52-a8f8-46c387f19710&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=7087347f&#x26;sv=1" alt=""><figcaption></figcaption></figure>

3. Click **Save.**

#### **Then, we will connect the products to colors:**

1. In the Shopify admin sidebar, go to the **Products** > Select the product you want to connect color metafield.
2. In the **Metafields** field, click on the "Color filter swatch" metafield that you've just created above > You will be able to select multiple colors from your list of colors that you defined using metaobjects.

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FB8HQzjSWaVzaw48HBL3t%252Fimage.png%3Falt%3Dmedia%26token%3Db52461ca-f880-429b-bcaa-fc49f2b7ed65&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=2c4d5692&#x26;sv=1" alt=""><figcaption></figcaption></figure>

3. Click **Save**.

#### **After you assign the metafield to products/ variants, you can set up the filter for your online store:**

1. In the [Shopify Search & Discovery](https://apps.shopify.com/search-and-discovery) app, go to **Filters**.
2. Click **Add filter** or choose an existing filter.
3. Click the **Source** field > select a metafield filter with a metaobject reference - "Color filter swatch".
4. Click **Display options**.
5. Set the **Label** field for filter values by selecting a metafield.
6. Check **Include visual** and select a visual style:
   * Choose **Swatch** for small color swatches or patterns. Set the swatch content by selecting:
     * A color field for the **Swatch color**.
     * An image field for the **Swatch pattern**.

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252F89nuqEj3YCaNVMxUmXwZ%252Fimage.png%3Falt%3Dmedia%26token%3D0289a22f-43ff-41a8-8c53-193f259322a0&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=9cd19275&#x26;sv=1" alt=""><figcaption></figcaption></figure>

* Choose **Image** for icons, logos, or other graphics that shouldn't be cropped.&#x20;
* Select an image field for the **Image**.

<figure><img src="https://docs.foxecom.com/~gitbook/image?url=https%3A%2F%2F1836495117-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOdebKCa6IK9qfbdvSKj0%252Fuploads%252FYsmF0YbWumVQUHuK8ylZ%252Fimage.png%3Falt%3Dmedia%26token%3D237c86ac-4def-4219-9c90-0c48ff51fab1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=4e4693e4&#x26;sv=1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Tip** :sparkles:

Themes often display a swatch's image before its color.&#x20;

For swatch displays, if you activate both **Swatch pattern** and **Swatch color**, the color is only displayed when there isn't an available pattern image for the filter value.
{% endhint %}

7. Click **Save**.

{% tabs %}
{% tab title="Image" %}

<figure><img src="/files/QqkDK5UloBcUIJoJt6OJ" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Swatch color" %}

<figure><img src="/files/rApg7GkHlTHzYJAvD0JE" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# 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.foxecom.com/megamog-theme/collections-and-products/collection-page/collection-sections/product-listing.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.
