> ## 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 Set To Rule and Extract Rule help to add missing data, fix errors and optimize your feed

Rules give you greater flexibility and control over your product data. You can modify data for all products or specific product groups by setting conditions. This allows you to transform and optimize your data for the best performance.

### Table of Contents

1. [What are Rules?](#1-what-are-rules)
* Set To Rule
* Extract Rule

2. [Why do I need to use Rules?](#1-why-do-i-need-to-use-rules)

3. [How can I set up Rules?](#1-how-can-i-set-up-rules)
* [Set up Rules to add missing required data](#3-1-set-up-rules-to-add-missing-required-data)
* [Set up Rules to resolve errors](#3-2-set-up-rules-to-resolve-errors)
* [Set up Rules to optimize feed](#3-3-set-up-rules-to-optimize-feed)

4. [The Default Rules of our App](#1-the-default-rules-of-our-app)
5. [Some Notes on How Rules Work](#1-some-notes-on-how-rules-work)
---

# What are Rules?

Rules allow you to adjust product attributes based on conditions. There are two types:

1. **Set To Rule**

This Rule sets a value for an attribute based on existing product attributes or static values you provide.

2. **Extract Rule**

This Rule searches for specific terms in your feed and assigns them to a designated attribute.

# Why do I need to use Rules?

Using Rules enables you to:

* **Add missing required data** (e.g., extracting color from a title to populate the "color" field)

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

* **Resolve errors** (e.g., setting a default value for "gtin" to meet listing requirements)

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

* **Optimize your feed** (e.g., enhancing product titles with additional details for better visibility)

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

# How can I set up Rules?

To set up Rules, navigate to **Feed Center** > Select your feed > **Field Mapping** > Click **Add Rule**.

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

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

### 1. Set up Rules to add missing required data

To extract missing color data from product titles:
1. Click **Add Rule** next to the **color** field.

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

2. Select **Extract** as the Rule Type.
3. Choose **Product Title** as the source.
4. Input keywords to extract colors.

|| By choosing **Whole words only**, our app only extracts the color if it matches with the entire keyword as entered (for example, it does not take the word "white" inside the word "off-white"). By choosing **Case sensitive**, our app only extracts the color if it matches exactly to the keyword entered (for example, it does not take the word "Purple" with a capital P).

5. Assign extracted values to the **color** field.

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

6. Apply to relevant products or specific items by setting the rule.

__For example__: if you only need to add color to dresses, you will have to choose **Some Products** > filter the products to be only dresses by setting the condition as **Product Type - Equal to - "dress" **

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

| You can create more than one sub-condition to filter a product group. Simply click on **Sub-condition** to create an **AND** condition.

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

| You can also create more than one condition. Simply click on  **Add-Condition(s)** to create another condition.

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

7. Click **Save** for the Rules to be applied. Afterwards, you will be able to see the Rules next to the field **Color**. Moreover, all the Rules you created are also displayed on the top right of the **Field Mapping** tab.

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

### 2. Set up Rules to resolve errors

To indicate missing GTIN values:
1. Click **Add Rule** next to **gtin**.
2. Select **Set To** as the Rule Type.
3. Assign **identifier exists** to "false".

![](https://storage.crisp.chat/users/helpdesk/website/-/c/b/9/2/cb92164b6e8ef000/1_1l1hkjl.png)
4. Apply to products with empty GTIN fields.

Since you only want to assign the attribute **identifier exists** to products that do not have GTIN, you need to choose **Some Products**. Then, you need to select the products that do not have GTIN by choosing **Barcode** to be **Is empty**.

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

### 3. Set up Rules to optimize feed

Having a qualified product feed is not enough to maximize your reach and sales. To achieve it, you need to [optimize your feed](https://socialhead.io/knowledge/optimize-product-feeds-on-google-shopping/), and one of the fields that needs to be prioritized is your **product title**. 

To enhance product titles:
1. Click **Add Rule** next to **title**.
2. Select **Set To** as the Rule Type.
3. Include additional attributes (e.g., color, SKU).

* If you are selling electronics and you want to include more information such as **color** and **SKU** in your title, you can choose these fields from the drop down list and type the punctuation to organize the title neatly (e.g. you can add a dash, or parentheses).

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

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

4. Apply to relevant products (e.g., electronics).

* If you only want to optimize the title for electronic products, you need to choose **Some Products**. Then, you need to select the products that belong to this category by choosing **brand** to be "Apple".

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

5. Save the Rule.

# The Default Rules of our App

Our app includes five Default Rules:
* **Availability** (e.g., "in stock" or "out of stock" based on inventory)
* **Price** adjustments
* **Shipping Weight** assignments

__For example__, Availability will include 2 Default Rules: 

* **Out of Stock**: If [P] Inventory < 0, [F] Availability = “out of stock”

* **In Stock**: If [P] Inventory > 0, [F] Availability = “in stock”

Nonetheless, you can choose to turn off the Default Rules and create rules of your own. Once you click on the **Manage All Rules** section on the top right, you can see the list of all Default Rules. 

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

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

# Some Notes on How Rules Work

* If multiple Rules apply to a product, the highest-ranked Rule (eg. Rule 1) takes precedence.

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

* Rules override [Mapping](https://socialhead.crisp.help/en/article/how-to-use-field-mapping-to-optimize-your-feed-z24btd/) settings
* If no Rule or Mapping applies, the attribute remains empty.
---

Rules provide a powerful way to manage and optimize product data, ensuring compliance and improving feed performance. By setting up Rules correctly, you can enhance product visibility, reduce errors, and maximize efficiency.

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