> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://socialhead.crisp.help/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to use Add rule and Extract rule function

As a merchant, managing product data efficiently is crucial for optimizing your online store. In this guide, we will cover common scenarios merchants encounter and demonstrate how to use the **Add Rule** and **Extract Rule** features to handle them effectively.

### Table of Contents

1. [Add Rule to Choose the Image That You Want](#1-add-rule-to-choose-the-image-that-you-want)
2. [Add Rule to Set Up the Custom Field](#1-add-rule-to-set-up-the-custom-field)
3. [Add Rule to Set Up the Gender Field](#1-add-rule-to-set-up-the-gender-field)
4. [Add Rule to Set Up the GTIN Field](#1-add-rule-to-set-up-the-gtin-field)
5. [Extract Rule for the Size/Color Field](#1-extract-rule-for-the-sizecolor-field)
6. [Add Rule to Set Up the Brand Field](#1-add-rule-to-set-up-the-brand-field)
---

# Add Rule to Choose the Image That You Want

If you want to select a specific image for a product, follow these steps:

1. Navigate to **Field Mapping** > **Image link** field.
2. Click **1 rule** > **Add Rule**.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_1etqpl2.png)

3. Configure as follows:
* **Set Value to**: the image URL of your choice.
* **Where**: Some Products.
* **If Product Title Equal to**: Enter the exact product name.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/2_ajo7bx.png)

# Add Rule to Set Up the Custom Field

**For example:** If you would like to categorize "T-Shirt" or "Dress" for your items in Facebook Catalog using a custom field, you can follow the steps below:

* **Step 1: **Create a Tag for Each Product

In the product detail page, enter a tag such as "T-Shirt" or "Dress."

![](https://storage.crisp.chat/users/upload/operator/b122d4a3f2caa80/1_hrexrd.jpg)

![](https://storage.crisp.chat/users/upload/operator/b122d4a3f2caa80/2_1djngoh.jpg)

* **Step 2:** Add Conditional Custom Label in Field Mapping

1. Navigate to **Field Mapping**.
2. Create rules:
* If **Keywords Contains** "T-Shirt" → **Set Value to** "T-Shirt".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_4cj87q.png)

* If **Keywords Contains** "Dress" → **Set Value to** "Dress".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_c0sydz.png)

* **Step 3:** At Set in Facebook Catalog, filtering Custom Label contains T-Shirt or Dress

![](https://storage.crisp.chat/users/upload/operator/b122d4a3f2caa80/5_8uavp1.jpg)

![](https://storage.crisp.chat/users/upload/operator/b122d4a3f2caa80/6_nbwwr0.jpg)

# Add Rule to Set Up the Gender Field

For gender-specific products, configure rules in **Field Mapping > Gender field > Add Rule**

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/2_1b5olg2.png)

* **For Male**:
* Set Value to **male**.
* Where: Some Products
* Condition: If **Keywords Contains** "male" AND does not contain "female".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/4_1kbz7c7.png)

* **For Female**:
* Set Value to **female**.
* Where: Some Products
* Condition: If **Keywords Contains** "female".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/5_1bddp6o.png)

* **For Unisex**:
* Set Value to **unisex**.
* Where: Some Products
* Condition: If **Keywords Contains** "unisex".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_t1br3c.png)

# Add Rule to Set Up the GTIN Field

For feed that contains products with and without GTIN (Global Trade Item Number) at the same time:

1. Go to **Feed Center** > **Field Mapping** > **Identifier Exists** field.
2. Set **Identifier Exists** to __"no"__.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_1427bhh.png)

Then click on **Add rule** and setup the rule as follow:
* Set Value to: yes
* Where: Some Products
* If Barcode Is not empty (if you enter the GTIN into Barcode on your website) 

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/2_fgjtec.png)

3. Then, configure the **GTIN** field by going to Field Mapping > GTIN > __DO NOT__ assign any value here

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/3_1ys87un.png)

 Then click on **Add Rule** and setup the rule as follow:
* Set Value to: Barcode.
* Where: Some Products
* Condition: If **Barcode Is Not Empty**.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/2_e8tgvk.png)

# Extract Rule for the Size/Color Field

If product variants use non-standard labels (e.g., "Màu sắc" instead of "Color"), use the **Extract Rule**

![](https://storage.crisp.chat/users/helpdesk/website/ab8a6f89b0a19000/image_1p8tckx.png)

1. Go to **Field Mapping** > **Color field** > **Add Rule**.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/5_1yf98nl.png)

2. Select **Extract**.
3. Set up:
* **Source: **Variant title.
* **Keyword:** List all color names.
* Choose **Whole words only **
* **Destination field: **Color.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/2_1odil92.png)

|| The app will check the variant title and it will automatically declare that color for the variant. You can also repeat the same process for **Size**.

# Add Rule to Set Up the Brand Field

For products missing a brand name, you can follow the steps below to add them in bulk:

1. Navigate to **Field Mapping** > **Brand field** > **Add Rule**.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_s3p4f1.png)

2. Configure:
* **Set Value to**: Enter the desired brand name.
* **Where**: Some Products.
* **If Vendor Is Empty**.

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/3_1tpkjxg.png)

---

By using the **Add Rule** and **Extract Rule** features, you can efficiently manage your product data, ensuring accurate and well-structured feeds. Whether it's selecting images, categorizing products, or extracting specific details, these rules streamline data organization and improve catalog performance.

If you have any further assistance, don't hesitate to contact us via in-app live chat or email at [support@socialhead.io](mailto:support@socialhead.io)