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

# Filters available in the core of CoCart

> These filters let you control how CoCart operates for your store

# Authentication & Security

This category contains filters for managing authentication, security headers, CORS settings, and access permissions.

`cocart_allow_origin`

Filter allows you to change the allowed HTTP origin result.

<Info>
  Made available since v2.5.1
</Info>

**Parameters**

<ParamField query="origin" type="string">
  Origin URL if allowed, empty string if not.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_allow_origin', function() {
    // Your code here
}, 10 );
```

[Search `cocart_allow_origin` in repository](https://github.com/co-cart/co-cart/search?q=cocart_allow_origin\&type=code)

***

`cocart_auth_header`

Filter allows you to change the authorization header.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="auth_header" type="string">
  Authorization header.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_auth_header', function() {
    // Your code here
}, 10 );
```

[Search `cocart_auth_header` in repository](https://github.com/co-cart/co-cart/search?q=cocart_auth_header\&type=code)

***

`cocart_disable_all_cors`

Modifies if the "Cross Origin Headers" are allowed. Set as false to enable support.

<Info>
  Made available since v2.2.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_disable_all_cors', function() {
    // Your code here
});
```

[Search `cocart_disable_all_cors` in repository](https://github.com/co-cart/co-cart/search?q=cocart_disable_all_cors\&type=code)

***

`cocart_install_capability`

Filter the current users capabilities to install a CoCart plugin.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="capability" type="string">
  Capability level.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_install_capability', function() {
    // Your code here
}, 10 );
```

[Search `cocart_install_capability` in repository](https://github.com/co-cart/co-cart/search?q=cocart_install_capability\&type=code)

***

`cocart_login_extras`

Filter allows you to add extra information based on the current user.

<Info>
  Made available since v3.8.1
</Info>

**Parameters**

<ParamField query="extra_information" type="array">
  The extra information.
</ParamField>

<ParamField query="current_user" type="object">
  The current user.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_login_extras', function() {
    // Your code here
}, 10 );
```

[Search `cocart_login_extras` in repository](https://github.com/co-cart/co-cart/search?q=cocart_login_extras\&type=code)

***

`cocart_send_nocache_headers`

Send nocache headers on authenticated requests.

<Info>
  Made available since v4.2.0
</Info>

<Warning>**Deprecated:** 4.3.11 No longer used. See `cocart_send_cache_control_patterns` filter instead to control which routes are not cached.</Warning>

**Parameters**

<ParamField query="rest_send_nocache_headers" type="boolean">
  Whether to send no-cache headers.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_send_nocache_headers', function() {
    // Your code here
}, 10 );
```

[Search `cocart_send_nocache_headers` in repository](https://github.com/co-cart/co-cart/search?q=cocart_send_nocache_headers\&type=code)

***

# Cart Management & State

This category contains filters for managing cart state, expiration, merging, and overall cart behavior.

`cocart_cart_cleared_message`

Filters message about the cart being cleared.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_cleared_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_cleared_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_cleared_message\&type=code)

***

`cocart_cart_contents`

Filter allows additional data to be returned for a specific item in cart.

<Info>
  Made available since v2.0.0
</Info>

**Parameters**

<ParamField query="cart_contents" type="array">
  Cart contents.
</ParamField>

<ParamField query="item_key" type="string">
  Item key.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_contents', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_contents` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_contents\&type=code)

***

`cocart_cart_expiration`

Filter allows you to change the amount of time before the cart has expired. Default is `(DAY_IN_SECONDS * 2)` = 2 Days - Previously 7 days.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="$expiration" type="int">
  Expiration.
</ParamField>

<ParamField query="$is_user_logged_in" type="boolean">
  If user is logged in. **@since v4.4.0**
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_expiration', function( $expiration, $is_user_logged_in ) {
    // Extend cart expiration for logged-in users to 14 days.
    if ( $is_user_logged_in ) {
        return WEEK_IN_SECONDS * 2;
    }

    // Fallback to 2 days for guest users.
    return $expiration;
}, 10, 2 );
```

[Search `cocart_cart_expiration` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_expiration\&type=code)

***

`cocart_cart_expiring`

Filter allows you to change the amount of time before the cart starts to expire. Default is \`\`\`(DAY\_IN\_SECONDS \* 6)\`\` = 6 Days

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_expiring', function() {
    // Your code here
});
```

[Search `cocart_cart_expiring` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_expiring\&type=code)

***

`cocart_cart_items`

Filter allows additional data to be returned for a specific item in cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="items" type="array">
  Array of items in the cart.
</ParamField>

<ParamField query="item_key" type="string">
  The item key currently looped.
</ParamField>

<ParamField query="cart_item" type="array">
  The cart item data.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_items', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_items` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_items\&type=code)

***

`cocart_cart_source`

Filter source of cart.

<Info>
  Made available since v3.0.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_source', function() {
    // Your code here
});
```

[Search `cocart_cart_source` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_source\&type=code)

***

`cocart_clear_cart_failed_message`

Filters message about the cart failing to clear.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_clear_cart_failed_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_clear_cart_failed_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_clear_cart_failed_message\&type=code)

***

`cocart_cross_sells`

Filters the cross sell items.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cross_sells', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cross_sells` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cross_sells\&type=code)

***

`cocart_empty_cart`

Filter response for empty cart.

<Info>
  Made available since v3.0.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_empty_cart', function() {
    // Your code here
});
```

[Search `cocart_empty_cart` in repository](https://github.com/co-cart/co-cart/search?q=cocart_empty_cart\&type=code)

***

`cocart_filter_request_data`

Filters additional requested data.

<Info>
  Made available since v3.0.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_filter_request_data', function() {
    // Your code here
});
```

[Search `cocart_filter_request_data` in repository](https://github.com/co-cart/co-cart/search?q=cocart_filter_request_data\&type=code)

***

`cocart_get_cart_item`

Filters the cart item before it is returned.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="item" type="array">
  Details of the item in the cart if it exists.
</ParamField>

<ParamField query="condition" type="string">
  Condition of item. Default: "add", Option: "add", "remove", "restore", "update".
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_get_cart_item', function() {
    // Your code here
}, 10 );
```

[Search `cocart_get_cart_item` in repository](https://github.com/co-cart/co-cart/search?q=cocart_get_cart_item\&type=code)

***

`cocart_merge_cart_content`

Filter allows you to adjust the merged cart contents.

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_merge_cart_content', function() {
    // Your code here
});
```

[Search `cocart_merge_cart_content` in repository](https://github.com/co-cart/co-cart/search?q=cocart_merge_cart_content\&type=code)

***

`cocart_return_cart_contents`

Return cart content from session if set.

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_return_cart_contents', function() {
    // Your code here
});
```

[Search `cocart_return_cart_contents` in repository](https://github.com/co-cart/co-cart/search?q=cocart_return_cart_contents\&type=code)

***

`cocart_return_cart_session_contents`

Return cart content from session if set.

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_return_cart_session_contents', function() {
    // Your code here
});
```

[Search `cocart_return_cart_session_contents` in repository](https://github.com/co-cart/co-cart/search?q=cocart_return_cart_session_contents\&type=code)

***

`cocart_return_empty_cart`

Filter response for empty cart.

<Info>
  Made available since v2.0.8
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_return_empty_cart', function() {
    // Your code here
});
```

[Search `cocart_return_empty_cart` in repository](https://github.com/co-cart/co-cart/search?q=cocart_return_empty_cart\&type=code)

***

# Cart Items & Operations

This category contains filters for cart item data, operations like adding/removing items, and item-specific messages.

`cocart_can_not_remove_item_message`

Filters message about can not remove item.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_remove_item_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_remove_item_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_remove_item_message\&type=code)

***

`cocart_can_not_restore_item_message`

Filters message about can not restore item.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_restore_item_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_restore_item_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_restore_item_message\&type=code)

***

`cocart_cart_item_data`

Filter allows you to alter the remaining cart item data.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="cart_item" type="array">
  The cart item data.
</ParamField>

<ParamField query="item_key" type="string">
  Generated ID based on the product information when added to the cart.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_data', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_data` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_data\&type=code)

***

`cocart_cart_item_key_required_message`

Filters message about cart item key required.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="status" type="string">
  Status of which we are checking the item key.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_key_required_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_key_required_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_key_required_message\&type=code)

***

`cocart_cart_item_name`

Filter allows the product name of the item to change.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="product_name" type="string">
  Product name.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="cart_item" type="array">
  The cart item data.
</ParamField>

<ParamField query="item_key" type="string">
  The item key generated based on the details of the item.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_name', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_name` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_name\&type=code)

***

`cocart_cart_item_removed_message`

Filter message about item removed from the cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_removed_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_removed_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_removed_message\&type=code)

***

`cocart_cart_item_restored_message`

Filters message about item restored.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="restored_message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_restored_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_restored_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_restored_message\&type=code)

***

`cocart_cart_item_restored_title`

Re-calculate totals now an item has been restored.

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_restored_title', function() {
    // Your code here
});
```

[Search `cocart_cart_item_restored_title` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_restored_title\&type=code)

***

`cocart_cart_item_title`

Filter allows the product title of the item to change.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="product_title" type="string">
  Product title.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="cart_item" type="array">
  The cart item data.
</ParamField>

<ParamField query="item_key" type="string">
  The item key generated based on the details of the item.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_title', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_title` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_title\&type=code)

***

`cocart_item_added`

Filter allows additional data to be returned.

<Info>
  Made available since v2.0.0
</Info>

**Parameters**

<ParamField query="item_added" type="array">
  Item added to cart.
</ParamField>

<ParamField query="item_key" type="string">
  Item key of the item added.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_added', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_added` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_added\&type=code)

***

`cocart_item_product`

Filter allows you to alter the item product data returned.

<Info>
  Made available since v2.0.0
</Info>

**Parameters**

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="cart_item" type="array">
  The cart item data.
</ParamField>

<ParamField query="item_key" type="string">
  The item key currently looped.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_product', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_product` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_product\&type=code)

***

`cocart_item_removed_message`

Filters message about item removed from cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_removed_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_removed_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_removed_message\&type=code)

***

`cocart_item_restored_message`

Filters message about item already restored to cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_restored_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_restored_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_restored_message\&type=code)

***

`cocart_item_thumbnail`

Filters the item thumbnail ID.

<Info>
  Made available since v2.0.0
</Info>

**Parameters**

<ParamField query="thumbnail_id" type="integer">
  Product thumbnail ID.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item.
</ParamField>

<ParamField query="item_key" type="string">
  Item key.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_thumbnail', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_thumbnail` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_thumbnail\&type=code)

***

`cocart_item_thumbnail_size`

Filters the thumbnail size of the product image.

<Info>
  Made available since v2.0.0
</Info>

**Parameters**

<ParamField query="removed_item" type="boolean">
  Determines if the item in the cart is removed.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_thumbnail_size', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_thumbnail_size` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_thumbnail_size\&type=code)

***

`cocart_item_thumbnail_src`

Filters the source of the product thumbnail.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="thumbnail_src" type="string">
  URL of the product thumbnail.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item.
</ParamField>

<ParamField query="item_key" type="string">
  Item key.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_thumbnail_src', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_thumbnail_src` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_thumbnail_src\&type=code)

***

`cocart_update_cart_validation`

Filter allows you to determine if the updated item in cart passed validation.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="cart_valid" type="boolean">
  True by default.
</ParamField>

<ParamField query="item_key" type="string">
  Item key.
</ParamField>

<ParamField query="current_data" type="array">
  Product data of the item in cart.
</ParamField>

<ParamField query="quantity" type="float">
  The requested quantity to change to.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_update_cart_validation', function() {
    // Your code here
}, 10 );
```

[Search `cocart_update_cart_validation` in repository](https://github.com/co-cart/co-cart/search?q=cocart_update_cart_validation\&type=code)

***

`cocart_update_item`

Filters the update status.

<Info>
  Made available since v2.0.1
</Info>

**Parameters**

<ParamField query="response" type="array">
  Status response.
</ParamField>

<ParamField query="new_data" type="array">
  Cart item.
</ParamField>

<ParamField query="quantity" type="integer">
  Quantity.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_update_item', function() {
    // Your code here
}, 10 );
```

[Search `cocart_update_item` in repository](https://github.com/co-cart/co-cart/search?q=cocart_update_item\&type=code)

***

# Product Validation & Messages

This category contains filters for product validation, stock checking, quantity limits, and related error messages.

`cocart_add_to_cart_quantity`

Filters the quantity for specified products.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="quantity" type="integer">
  The original quantity of the item.
</ParamField>

<ParamField query="product_id" type="integer">
  The product ID.
</ParamField>

<ParamField query="variation_id" type="integer">
  The variation ID.
</ParamField>

<ParamField query="variation" type="array">
  The variation data.
</ParamField>

<ParamField query="cart_item_data" type="array">
  The cart item data.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_add_to_cart_quantity', function() {
    // Your code here
}, 10 );
```

[Search `cocart_add_to_cart_quantity` in repository](https://github.com/co-cart/co-cart/search?q=cocart_add_to_cart_quantity\&type=code)

***

`cocart_add_to_cart_sold_individually_found_in_cart`

Quantity for sold individual products can be filtered.

<Info>
  Made available since v2.0.13
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_add_to_cart_sold_individually_found_in_cart', function() {
    // Your code here
});
```

[Search `cocart_add_to_cart_sold_individually_found_in_cart` in repository](https://github.com/co-cart/co-cart/search?q=cocart_add_to_cart_sold_individually_found_in_cart\&type=code)

***

`cocart_add_to_cart_sold_individually_quantity`

Quantity for sold individual products can be filtered.

<Info>
  Made available since v2.0.13
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_add_to_cart_sold_individually_quantity', function() {
    // Your code here
});
```

[Search `cocart_add_to_cart_sold_individually_quantity` in repository](https://github.com/co-cart/co-cart/search?q=cocart_add_to_cart_sold_individually_quantity\&type=code)

***

`cocart_can_not_increase_quantity_message`

Filters message about product not being allowed to increase quantity.

<Info>
  Made available since v1.0.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_increase_quantity_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_increase_quantity_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_increase_quantity_message\&type=code)

***

`cocart_can_not_update_item_message`

Filters message about can not update item.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_update_item_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_update_item_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_update_item_message\&type=code)

***

`cocart_cannot_add_product_type_to_cart_message`

Filters message about product type that cannot be added to the cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product_data" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cannot_add_product_type_to_cart_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cannot_add_product_type_to_cart_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cannot_add_product_type_to_cart_message\&type=code)

***

`cocart_cart_item_required_stock_is_not_enough`

Allows filter if product have enough stock to get added to the cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="has_stock" type="boolean">
  If have enough stock.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item values.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_required_stock_is_not_enough', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_required_stock_is_not_enough` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_required_stock_is_not_enough\&type=code)

***

`cocart_invalid_variation_data_message`

Filters message about invalid variation data.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="attribute_label" type="string">
  Attribute Label.
</ParamField>

<ParamField query="attribute" type="array">
  Allowed values.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_invalid_variation_data_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_invalid_variation_data_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_invalid_variation_data_message\&type=code)

***

`cocart_missing_variation_data_message`

Filters message about missing variation data.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="missing_attributes" type="string">
  Number of missing attributes.
</ParamField>

<ParamField query="missing_attributes" type="array">
  List of missing attributes.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_missing_variation_data_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_missing_variation_data_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_missing_variation_data_message\&type=code)

***

`cocart_product_can_not_add_another_message`

Filters message about product not being allowed to add another.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_can_not_add_another_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_can_not_add_another_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_can_not_add_another_message\&type=code)

***

`cocart_product_cannot_add_to_cart_message`

Filters message about product cannot be added to cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product_data" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_cannot_add_to_cart_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_cannot_add_to_cart_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_cannot_add_to_cart_message\&type=code)

***

`cocart_product_cannot_be_added_message`

Filters message about product that cannot be added to cart.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_cannot_be_added_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_cannot_be_added_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_cannot_be_added_message\&type=code)

***

`cocart_product_cannot_be_purchased_message`

Filters message about product unable to be purchased.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_cannot_be_purchased_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_cannot_be_purchased_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_cannot_be_purchased_message\&type=code)

***

`cocart_product_does_not_exist_message`

Filters message about product does not exist.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_does_not_exist_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_does_not_exist_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_does_not_exist_message\&type=code)

***

`cocart_product_failed_validation_message`

Filters message about product failing validation.

<Info>
  Made available since v1.0.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_failed_validation_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_failed_validation_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_failed_validation_message\&type=code)

***

`cocart_product_is_out_of_stock_message`

Filters message about product is out of stock.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_is_out_of_stock_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_is_out_of_stock_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_is_out_of_stock_message\&type=code)

***

`cocart_product_not_enough_stock_message`

Filters message about product not having enough stock.

<Info>
  Made available since v3.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="stock_quantity" type="integer">
  Quantity remaining.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_not_enough_stock_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_not_enough_stock_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_not_enough_stock_message\&type=code)

***

`cocart_quantity_maximum_allowed`

Filters the products maximum quantity allowed to be purchased.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_quantity_maximum_allowed', function() {
    // Your code here
});
```

[Search `cocart_quantity_maximum_allowed` in repository](https://github.com/co-cart/co-cart/search?q=cocart_quantity_maximum_allowed\&type=code)

***

`cocart_quantity_minimum_requirement`

Filters the minimum quantity requirement the product allows to be purchased.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_quantity_minimum_requirement', function() {
    // Your code here
});
```

[Search `cocart_quantity_minimum_requirement` in repository](https://github.com/co-cart/co-cart/search?q=cocart_quantity_minimum_requirement\&type=code)

***

`cocart_skip_woocommerce_item_validation`

Filter the item to skip product validation as it is added to cart.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="validate_product" type="boolean">
  Whether to validate the product or not.
</ParamField>

<ParamField query="product_data" type="array">
  Contains the product data of the product to add to cart.
</ParamField>

<ParamField query="product_id" type="integer">
  The product ID.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_skip_woocommerce_item_validation', function() {
    // Your code here
}, 10 );
```

[Search `cocart_skip_woocommerce_item_validation` in repository](https://github.com/co-cart/co-cart/search?q=cocart_skip_woocommerce_item_validation\&type=code)

***

# Session & Customer Management

This category contains filters for session handling, customer data, and cart loading behavior.

`cocart_disable_load_cart`

Filter checks if <Tooltip tip="Load Cart is a feature that is not part of the REST API." cta="See the Load Cart feature" href="/documentation/load-cart">**Load Cart**</Tooltip> feature is disabled.

<Info>
  Made available since v3.0.0
</Info>

**Returns**: `bool`

**Usage**

```php theme={"system"}
add_filter( 'cocart_disable_load_cart', function() {
    // Your code here
});
```

[Search `cocart_disable_load_cart` in repository](https://github.com/co-cart/co-cart/search?q=cocart_disable_load_cart\&type=code)

***

`cocart_load_cart_query_name`

Filter allows developers to add more white labelling when loading the cart via web.

<Info>
  Made available since v2.8.2
</Info>

**Parameters**

<ParamField query="action_query" type="string">
  Default is 'cocart-load-cart'.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_load_cart_query_name', function() {
    // Your code here
}, 10 );
```

[Search `cocart_load_cart_query_name` in repository](https://github.com/co-cart/co-cart/search?q=cocart_load_cart_query_name\&type=code)

***

`cocart_requested_cart_key`

Filter allows the cart key to be overridden. Developer Note: Really only here so I don't have to create a new session handler to inject a customer ID with the POS Support Add-on.

<Info>
  Made available since v4.2.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_requested_cart_key', function() {
    // Your code here
});
```

[Search `cocart_requested_cart_key` in repository](https://github.com/co-cart/co-cart/search?q=cocart_requested_cart_key\&type=code)

***

`cocart_set_customer_id`

Filter allows to set the customer ID.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="current_user_id" type="integer">
  Current user ID.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_set_customer_id', function() {
    // Your code here
}, 10 );
```

[Search `cocart_set_customer_id` in repository](https://github.com/co-cart/co-cart/search?q=cocart_set_customer_id\&type=code)

***

# Product Data & Display

This category contains filters for product information display, pricing, metadata, and attributes.

`cocart_prepare_money_disable_decimals`

This filter allows you to disable the decimals. If set to "True" the decimals will be set to "Zero".

<Info>
  Made available since v2.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_prepare_money_disable_decimals', function() {
    // Your code here
});
```

[Search `cocart_prepare_money_disable_decimals` in repository](https://github.com/co-cart/co-cart/search?q=cocart_prepare_money_disable_decimals\&type=code)

***

`cocart_prepare_product_attribute`

Filter a attribute item returned from the API. Allows modification of the product attribute data right before it is returned.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="response" type="WP_REST_Response">
  The response object.
</ParamField>

<ParamField query="item" type="object">
  The original attribute object.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_prepare_product_attribute', function() {
    // Your code here
}, 10 );
```

[Search `cocart_prepare_product_attribute` in repository](https://github.com/co-cart/co-cart/search?q=cocart_prepare_product_attribute\&type=code)

***

`cocart_prepare_product_object`

Filter the data for a response.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="response" type="WP_REST_Response">
  The response object.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_prepare_product_object', function() {
    // Your code here
}, 10 );
```

[Search `cocart_prepare_product_object` in repository](https://github.com/co-cart/co-cart/search?q=cocart_prepare_product_object\&type=code)

***

`cocart_price_no_html`

Filters the string of price markup.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="return" type="string">
  Price HTML markup.
</ParamField>

<ParamField query="price" type="string">
  Formatted price.
</ParamField>

<ParamField query="args" type="array">
  Pass on the args.
</ParamField>

<ParamField query="unformatted_price" type="float">
  Price as float to allow plugins custom formatting. Since 3.2.0.
</ParamField>

<ParamField query="original_price" type="float|string">
  Original price as float, or empty string. Since 5.0.0.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_price_no_html', function() {
    // Your code here
}, 10 );
```

[Search `cocart_price_no_html` in repository](https://github.com/co-cart/co-cart/search?q=cocart_price_no_html\&type=code)

***

`cocart_product_title`

Filters the product title in cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="product_title" type="string">
  Product title.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item.
</ParamField>

<ParamField query="item_key" type="string">
  Item key.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_title', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_title` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_title\&type=code)

***

`cocart_products_add_to_cart_rest_url`

Filters the REST URL shortcut for adding the product to cart.

<Info>
  Made available since v3.1.0
</Info>

**Parameters**

<ParamField query="rest_url" type="string">
  REST URL for adding product to the cart.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

<ParamField query="type" type="string">
  Product type.
</ParamField>

<ParamField query="id" type="integer">
  Product ID.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_products_add_to_cart_rest_url', function() {
    // Your code here
}, 10 );
```

[Search `cocart_products_add_to_cart_rest_url` in repository](https://github.com/co-cart/co-cart/search?q=cocart_products_add_to_cart_rest_url\&type=code)

***

`cocart_products_get_price_range`

Filters the products price range.

<Info>
  Made available since v3.1.0
</Info>

**Parameters**

<ParamField query="price" type="array">
  The current product price range.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_products_get_price_range', function() {
    // Your code here
}, 10 );
```

[Search `cocart_products_get_price_range` in repository](https://github.com/co-cart/co-cart/search?q=cocart_products_get_price_range\&type=code)

***

`cocart_products_get_safe_meta_data`

Filter allows you to control what remaining product meta data is safe to return.

<Info>
  Made available since v3.11.0
</Info>

**Parameters**

<ParamField query="safe_meta" type="array">
  Safe meta.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_products_get_safe_meta_data', function() {
    // Your code here
}, 10 );
```

[Search `cocart_products_get_safe_meta_data` in repository](https://github.com/co-cart/co-cart/search?q=cocart_products_get_safe_meta_data\&type=code)

***

`cocart_products_ignore_private_meta_keys`

Filter allows you to ignore private meta data for the product to return. When filtering, only list the meta key!

<Info>
  Made available since v3.11.0
</Info>

**Parameters**

<ParamField query="ignored_meta_keys" type="array">
  Ignored meta keys.
</ParamField>

<ParamField query="product" type="WC_Product">
  The product object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_products_ignore_private_meta_keys', function() {
    // Your code here
}, 10 );
```

[Search `cocart_products_ignore_private_meta_keys` in repository](https://github.com/co-cart/co-cart/search?q=cocart_products_ignore_private_meta_keys\&type=code)

***

`cocart_products_variable_empty_price`

Filter the variable products empty prices.

<Info>
  Made available since v3.1.0
</Info>

**Parameters**

<ParamField query="empty_prices" type="array">
  Empty array.
</ParamField>

<ParamField query="product" type="WC_Product">
  The project object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_products_variable_empty_price', function() {
    // Your code here
}, 10 );
```

[Search `cocart_products_variable_empty_price` in repository](https://github.com/co-cart/co-cart/search?q=cocart_products_variable_empty_price\&type=code)

***

# System Environment & Status

This category contains filters for system environment detection, staging sites, and general status information.

`cocart_does_product_allow_price_change`

Filter which products that can be allowed to override the price if not all.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="allow_change" type="boolean">
  Allow price change.
</ParamField>

<ParamField query="cart_item" type="array">
  Cart item.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_does_product_allow_price_change', function() {
    // Your code here
}, 10 );
```

[Search `cocart_does_product_allow_price_change` in repository](https://github.com/co-cart/co-cart/search?q=cocart_does_product_allow_price_change\&type=code)

***

`cocart_is_rest_api_request`

Filters the REST API requested.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="is_rest_api_request" type="boolean">
  True if CoCart REST API is requested.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_is_rest_api_request', function() {
    // Your code here
}, 10 );
```

[Search `cocart_is_rest_api_request` in repository](https://github.com/co-cart/co-cart/search?q=cocart_is_rest_api_request\&type=code)

***

`cocart_return_default_response`

**See Also:**

* `cocart_{$endpoint}_response`
  Filter decides if the responses return as default or use the modified response which is filtered by the rest base.

<Info>
  Made available since v3.0.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_return_default_response', function() {
    // Your code here
});
```

[Search `cocart_return_default_response` in repository](https://github.com/co-cart/co-cart/search?q=cocart_return_default_response\&type=code)

***

`cocart_totals_calculated_message`

Filters message about cart totals have been calculated.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_totals_calculated_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_totals_calculated_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_totals_calculated_message\&type=code)

***

# Admin & Plugin Management

This category contains filters for plugin administration, updates, submenus, and overall plugin configuration.

`cocart_enable_setup_wizard`

See if we need the setup wizard or not.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_enable_setup_wizard', function() {
    // Your code here
});
```

[Search `cocart_enable_setup_wizard` in repository](https://github.com/co-cart/co-cart/search?q=cocart_enable_setup_wizard\&type=code)

***

`cocart_get_plugins_for_cocart`

Filter allows you to get plugins which "maybe" are for CoCart.

<Info>
  Made available since v4.3.0
</Info>

**Parameters**

<ParamField query="matches" type="array">
  Array of plugins that "maybe" are for CoCart.
</ParamField>

<ParamField query="plugins" type="array">
  Array of plugins installed.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_get_plugins_for_cocart', function() {
    // Your code here
}, 10 );
```

[Search `cocart_get_plugins_for_cocart` in repository](https://github.com/co-cart/co-cart/search?q=cocart_get_plugins_for_cocart\&type=code)

***

`cocart_get_plugins_with_header`

Filter allows you to get the plugins that have a valid value for a specific header.

<Info>
  Made available since v4.3.0
</Info>

**Parameters**

<ParamField query="matches" type="array">
  Array of plugins matched with header.
</ParamField>

<ParamField query="header" type="string">
  Plugin header to search for.
</ParamField>

<ParamField query="plugins" type="array">
  Array of plugins installed.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_get_plugins_with_header', function() {
    // Your code here
}, 10 );
```

[Search `cocart_get_plugins_with_header` in repository](https://github.com/co-cart/co-cart/search?q=cocart_get_plugins_with_header\&type=code)

***

`cocart_in_plugin_update_message`

Filter allows you to change the upgrade notice.

<Info>
  Made available since v4.3.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_in_plugin_update_message', function() {
    // Your code here
});
```

[Search `cocart_in_plugin_update_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_in_plugin_update_message\&type=code)

***

`cocart_register_submenu_page`

Hook to register submenu\_pages class handlers The array element should be 'submenu\_page\_slug' => array( 'class\_name' => array(), 'data' => array() )

<Info>
  Made available since v3.10.0
</Info>

**Parameters**

<ParamField query="submenus" type="array">
  Array of submenu pages.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_register_submenu_page', function() {
    // Your code here
}, 10 );
```

[Search `cocart_register_submenu_page` in repository](https://github.com/co-cart/co-cart/search?q=cocart_register_submenu_page\&type=code)

***

`cocart_show_plugin_search`

Filter if <Tooltip tip="Plugin Suggestions help you to discover other plugins that may work with CoCart." cta="Read more about it" href="/knowledge-base/plugin-suggestions">**CoCart Plugin Suggestions**</Tooltip> should be active.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="show_suggestions" type="boolean">
  True if CoCart Plugin Suggestions is active.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_show_plugin_search', function() { return false; });
```

[Search `cocart_show_plugin_search` in repository](https://github.com/co-cart/co-cart/search?q=cocart_show_plugin_search\&type=code)

***

# API Schema & Parameters

This category contains filters that control API schema definitions, query parameters, and how data is structured in API responses.

`cocart_add_item_query_parameters`

Filters the query parameters for adding item to cart. This filter allows you to extend the query parameters without removing any default parameters.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_add_item_query_parameters', function() {
    // Your code here
});
```

[Search `cocart_add_item_query_parameters` in repository](https://github.com/co-cart/co-cart/search?q=cocart_add_item_query_parameters\&type=code)

***

`cocart_add_items_query_parameters`

Extends the query parameters. Dev Note: Nothing needs to pass so your safe if you think you will remove any default parameters.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_add_items_query_parameters', function() {
    // Your code here
});
```

[Search `cocart_add_items_query_parameters` in repository](https://github.com/co-cart/co-cart/search?q=cocart_add_items_query_parameters\&type=code)

***

`cocart_cart_items_schema`

Extend the cart schema properties for items. This filter allows you to extend the cart schema properties for items without removing any default properties.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_items_schema', function() {
    // Your code here
});
```

[Search `cocart_cart_items_schema` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_items_schema\&type=code)

***

`cocart_cart_query_parameters`

Extend the query parameters for the cart. This filter allows you to extend the query parameters without removing any default parameters.

<Info>
  Made available since v3.1.0
</Info>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_query_parameters', function() {
    // Your code here
});
```

[Search `cocart_cart_query_parameters` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_query_parameters\&type=code)

***

`cocart_prevent_wc_admin_note_created`

Filter to prevent note from being created.

<Info>
  Made available since v3.2.0
</Info>

**Parameters**

<ParamField query="prevent_note_creation" type="boolean">
  False by default.
</ParamField>

<ParamField query="args" type="array">
  Arguments to create the note.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_prevent_wc_admin_note_created', function() {
    // Your code here
}, 10 );
```

[Search `cocart_prevent_wc_admin_note_created` in repository](https://github.com/co-cart/co-cart/search?q=cocart_prevent_wc_admin_note_created\&type=code)

***

`cocart_store_index`

Filters the API store index data. This contains the data describing the API. This includes information about the store, routes available on the API, and a small amount of data about the site.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="response" type="WP_REST_Response">
  Response data.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_store_index', function() {
    // Your code here
}, 10 );
```

[Search `cocart_store_index` in repository](https://github.com/co-cart/co-cart/search?q=cocart_store_index\&type=code)

***

# Product Reviews

This category contains filters for managing product reviews, their processing, and related queries.

`cocart_pre_insert_product_review`

Filters a review before it is inserted via the REST API. Allows modification of the review right before it is inserted via `wp_insert_comment()`. Returning a *WP\_Error* value from the filter will short circuit insertion and allow skipping further processing.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="prepared_review" type="array|WP_Error">
  The prepared review data for `wp_insert_comment()`.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  Full details about the request.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_pre_insert_product_review', function() {
    // Your code here
}, 10 );
```

[Search `cocart_pre_insert_product_review` in repository](https://github.com/co-cart/co-cart/search?q=cocart_pre_insert_product_review\&type=code)

***

`cocart_prepare_product_review`

Filter product reviews object returned from the REST API.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="response" type="WP_REST_Response">
  The response object.
</ParamField>

<ParamField query="review" type="WP_Comment">
  Product review object used to create response.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_prepare_product_review', function() {
    // Your code here
}, 10 );
```

[Search `cocart_prepare_product_review` in repository](https://github.com/co-cart/co-cart/search?q=cocart_prepare_product_review\&type=code)

***

`cocart_preprocess_product_review`

Filters a review after it is prepared for the database. Allows modification of the review right after it is prepared for the database.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="prepared_review" type="array">
  The prepared review data for `wp_insert_comment`.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_preprocess_product_review', function() {
    // Your code here
}, 10 );
```

[Search `cocart_preprocess_product_review` in repository](https://github.com/co-cart/co-cart/search?q=cocart_preprocess_product_review\&type=code)

***

`cocart_product_review_collection_params`

Filter collection parameters for the reviews controller. This filter registers the collection parameter, but does not map the collection parameter to an internal *WP\_Comment\_Query* parameter. Use the `cocart_product_review_query` filter to set *WP\_Comment\_Query* parameters.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="params" type="array">
  JSON Schema-formatted collection parameters.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_review_collection_params', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_review_collection_params` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_review_collection_params\&type=code)

***

`cocart_product_review_query`

Filters arguments, before passing to WP\_Comment\_Query, when querying reviews via the REST API.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="prepared_args" type="array">
  Array of arguments for *WP\_Comment\_Query*.
</ParamField>

<ParamField query="request" type="WP_REST_Request">
  The request object.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_product_review_query', function() {
    // Your code here
}, 10 );
```

[Search `cocart_product_review_query` in repository](https://github.com/co-cart/co-cart/search?q=cocart_product_review_query\&type=code)

***

# Shipping & Packages

This category contains filters for shipping packages, methods, and shipping-related calculations.

`cocart_available_shipping_packages`

Filter allows you to alter the shipping packages returned.

<Info>
  Made available since v4.1.0
</Info>

**Parameters**

<ParamField query="packages" type="array">
  Available shipping packages.
</ParamField>

<ParamField query="chosen_method" type="array">
  Chosen shipping method.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_available_shipping_packages', function() {
    // Your code here
}, 10 );
```

[Search `cocart_available_shipping_packages` in repository](https://github.com/co-cart/co-cart/search?q=cocart_available_shipping_packages\&type=code)

***

`cocart_shipping_package_details_array`

Filter allows you to change the package details.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="product_names" type="array">
  Product names.
</ParamField>

<ParamField query="package" type="array">
  Package details.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_shipping_package_details_array', function() {
    // Your code here
}, 10 );
```

[Search `cocart_shipping_package_details_array` in repository](https://github.com/co-cart/co-cart/search?q=cocart_shipping_package_details_array\&type=code)

***

`cocart_shipping_package_name`

Filters the package name for the shipping method.

<Info>
  Made available since v3.0.0
</Info>

**Parameters**

<ParamField query="shipping_name" type="string">
  Shipping name.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_shipping_package_name', function() {
    // Your code here
}, 10 );
```

[Search `cocart_shipping_package_name` in repository](https://github.com/co-cart/co-cart/search?q=cocart_shipping_package_name\&type=code)

***

# Error Messages & Notifications

This category contains filters for various error messages and user notifications throughout the cart system.

`cocart_can_not_remove_item_message`

Filters message about can not remove item.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_remove_item_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_remove_item_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_remove_item_message\&type=code)

***

`cocart_can_not_restore_item_message`

Filters message about can not restore item.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_can_not_restore_item_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_can_not_restore_item_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_can_not_restore_item_message\&type=code)

***

`cocart_cart_item_key_required_message`

Filters message about cart item key required.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="status" type="string">
  Status of which we are checking the item key.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_cart_item_key_required_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_cart_item_key_required_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_cart_item_key_required_message\&type=code)

***

`cocart_item_not_in_cart_message`

Filters message about cart item key required.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

<ParamField query="method" type="string">
  Method.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_item_not_in_cart_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_item_not_in_cart_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_item_not_in_cart_message\&type=code)

***

`cocart_no_items_in_cart_message`

Filters message about no items in the cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_no_items_in_cart_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_no_items_in_cart_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_no_items_in_cart_message\&type=code)

***

`cocart_no_items_message`

Filters message about no items in cart.

<Info>
  Made available since v2.1.0
</Info>

**Parameters**

<ParamField query="message" type="string">
  Message.
</ParamField>

**Usage**

```php theme={"system"}
add_filter( 'cocart_no_items_message', function() {
    // Your code here
}, 10 );
```

[Search `cocart_no_items_message` in repository](https://github.com/co-cart/co-cart/search?q=cocart_no_items_message\&type=code)

***
