> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Lab - Complex Rules

Plan: Developer Foundations

Lesson 16 of 21 · 30 min

This lab activity will give you a chance to practice working with complex rules via the Catalog API. Each step will walk you through how to use all of the endpoints covered in the previous lesson.

### Prerequisites:

* BigCommerce store (sandbox or live)
* Basic knowledge of APIs
* REST client (Postman)
* Completion of previous Catalog API labs

### In this lab, you will:

* Create a second modifier option
* GET modifier options
* Create a complex rule
* GET complex rules

## Create a Second Modifier Option

1. **Copy** and **paste** the request below into Postman

```http showLineNumbers={false}
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/modifiers
```

2. Enter the ID of the product created in previous lab for `product_id` in the Params tab
3. **Copy** and **paste** the code below into the Body section of Postman

```json showLineNumbers={false}
{
  "type": "checkbox",
  "required": false,
  "config": {
    "default_value": "Yes",
    "checked_by_default": false,
    "checkbox_label": "Check to receive a sticker"
  },
  "display_name": "Add an 'I Donated' sticker"
}
```

4. **Select** POST next to the request url
5. **Click** the Send button
6. **Observe** response and modifier option added to product

## Get Modifier Options

1. **Copy** and **paste** the request below into Postman

```http showLineNumbers={false}
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/modifiers
```

2. Enter the ID of the product created in previous lab for `product_id` in the Params tab
3. **Select** GET next to the request url (if not already selected)
4. **Click** the Send button
5. **Observe** response
6. **Copy** `modifier_id`s and `modifier_value_id`s for next steps

![Modifier IDs in response](/_fern-files/bigcommerce.docs.buildwithfern.com/d6f36a9a655a327703f558e6563873cfddfd40abe9d1f23132d84fe8e1ff6461/assets/learn/catalog-rest-api/2019-03-21_1231.png)

## Create a Complex Rule

1. **Copy** and **paste** the request below into Postman

```http showLineNumbers={false}
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/complex-rules
```

2. **Enter** the ID of the product created in previous lab for `product_id` in the Params tab
3. **Copy** and **paste** the code below into the Body section of Postman

```json showLineNumbers={false}
{
  "enabled": true,
  "purchasing_disabled": true,
  "purchasing_disabled_message": "You must donate before you can receive a sticker.",
  "conditions": [
    {
      "modifier_id": {modifier_id},
      "modifier_value_id": {modifier_value_id}
    },
    {
      "modifier_id": {modifier_id},
      "modifier_value_id": {modifier_value_id}
    }
  ]
}
```

4. **Replace** `{modifier_id}` with the IDs of the checkbox modifier options: `donation_checked` and `sticker_checked` respectively
5. **Replace** `{modifier_value_id}` with the ID of the `checked` modifier value to `0` and `1` respectively
6. **Select** POST next to the request url
7. **Click** the Send button
8. **Observe** response and complex rule functioning on the product

## GET Complex Rules

1. **Copy** and **paste** the request below into Postman

```http showLineNumbers={false}
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/complex-rules
```

2. Enter the ID of the product created in previous lab for `product_id` in the Params tab
3. **Select** GET next to the request url
4. **Click** the Send button
5. **Observe** response