Skip to main content

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.
Made available since v2.5.1
Parameters
origin
string
Origin URL if allowed, empty string if not.
Usage
add_filter( 'cocart_allow_origin', function() {
    // Your code here
}, 10 );
Search cocart_allow_origin in repository
cocart_auth_header Filter allows you to change the authorization header.
Made available since v4.1.0
Parameters
auth_header
string
Authorization header.
Usage
add_filter( 'cocart_auth_header', function() {
    // Your code here
}, 10 );
Search cocart_auth_header in repository
cocart_disable_all_cors Modifies if the “Cross Origin Headers” are allowed. Set as false to enable support.
Made available since v2.2.0
Usage
add_filter( 'cocart_disable_all_cors', function() {
    // Your code here
});
Search cocart_disable_all_cors in repository
cocart_install_capability Filter the current users capabilities to install a CoCart plugin.
Made available since v4.1.0
Parameters
capability
string
Capability level.
Usage
add_filter( 'cocart_install_capability', function() {
    // Your code here
}, 10 );
Search cocart_install_capability in repository
cocart_login_extras Filter allows you to add extra information based on the current user.
Made available since v3.8.1
Parameters
extra_information
array
The extra information.
current_user
object
The current user.
Usage
add_filter( 'cocart_login_extras', function() {
    // Your code here
}, 10 );
Search cocart_login_extras in repository
cocart_send_nocache_headers Send nocache headers on authenticated requests.
Made available since v4.2.0
Deprecated: 4.3.11 No longer used. See cocart_send_cache_control_patterns filter instead to control which routes are not cached.
Parameters
rest_send_nocache_headers
boolean
Whether to send no-cache headers.
Usage
add_filter( 'cocart_send_nocache_headers', function() {
    // Your code here
}, 10 );
Search cocart_send_nocache_headers in repository

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.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_cart_cleared_message', function() {
    // Your code here
}, 10 );
Search cocart_cart_cleared_message in repository
cocart_cart_contents Filter allows additional data to be returned for a specific item in cart.
Made available since v2.0.0
Parameters
cart_contents
array
Cart contents.
item_key
string
Item key.
cart_item
array
Cart item.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_cart_contents', function() {
    // Your code here
}, 10 );
Search cocart_cart_contents in repository
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.
Made available since v2.1.0
Parameters
$expiration
int
Expiration.
$is_user_logged_in
boolean
If user is logged in. @since v4.4.0
Usage
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
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
Made available since v2.1.0
Usage
add_filter( 'cocart_cart_expiring', function() {
    // Your code here
});
Search cocart_cart_expiring in repository
cocart_cart_items Filter allows additional data to be returned for a specific item in cart.
Made available since v2.1.0
Parameters
items
array
Array of items in the cart.
item_key
string
The item key currently looped.
cart_item
array
The cart item data.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_cart_items', function() {
    // Your code here
}, 10 );
Search cocart_cart_items in repository
cocart_cart_source Filter source of cart.
Made available since v3.0.0
Usage
add_filter( 'cocart_cart_source', function() {
    // Your code here
});
Search cocart_cart_source in repository
cocart_clear_cart_failed_message Filters message about the cart failing to clear.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_clear_cart_failed_message', function() {
    // Your code here
}, 10 );
Search cocart_clear_cart_failed_message in repository
cocart_cross_sells Filters the cross sell items.
Made available since v3.0.0
Parameters
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_cross_sells', function() {
    // Your code here
}, 10 );
Search cocart_cross_sells in repository
cocart_empty_cart Filter response for empty cart.
Made available since v3.0.0
Usage
add_filter( 'cocart_empty_cart', function() {
    // Your code here
});
Search cocart_empty_cart in repository
cocart_filter_request_data Filters additional requested data.
Made available since v3.0.0
Usage
add_filter( 'cocart_filter_request_data', function() {
    // Your code here
});
Search cocart_filter_request_data in repository
cocart_get_cart_item Filters the cart item before it is returned.
Made available since v3.0.0
Parameters
item
array
Details of the item in the cart if it exists.
condition
string
Condition of item. Default: “add”, Option: “add”, “remove”, “restore”, “update”.
Usage
add_filter( 'cocart_get_cart_item', function() {
    // Your code here
}, 10 );
Search cocart_get_cart_item in repository
cocart_merge_cart_content Filter allows you to adjust the merged cart contents.
Made available since v2.1.0
Usage
add_filter( 'cocart_merge_cart_content', function() {
    // Your code here
});
Search cocart_merge_cart_content in repository
cocart_return_cart_contents Return cart content from session if set.
Made available since v2.1.0
Usage
add_filter( 'cocart_return_cart_contents', function() {
    // Your code here
});
Search cocart_return_cart_contents in repository
cocart_return_cart_session_contents Return cart content from session if set.
Made available since v2.1.0
Usage
add_filter( 'cocart_return_cart_session_contents', function() {
    // Your code here
});
Search cocart_return_cart_session_contents in repository
cocart_return_empty_cart Filter response for empty cart.
Made available since v2.0.8
Usage
add_filter( 'cocart_return_empty_cart', function() {
    // Your code here
});
Search cocart_return_empty_cart in repository

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.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_can_not_remove_item_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_remove_item_message in repository
cocart_can_not_restore_item_message Filters message about can not restore item.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_can_not_restore_item_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_restore_item_message in repository
cocart_cart_item_data Filter allows you to alter the remaining cart item data.
Made available since v3.0.0
Parameters
cart_item
array
The cart item data.
item_key
string
Generated ID based on the product information when added to the cart.
Usage
add_filter( 'cocart_cart_item_data', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_data in repository
cocart_cart_item_key_required_message Filters message about cart item key required.
Made available since v2.1.0
Parameters
message
string
Message.
status
string
Status of which we are checking the item key.
Usage
add_filter( 'cocart_cart_item_key_required_message', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_key_required_message in repository
cocart_cart_item_name Filter allows the product name of the item to change.
Made available since v3.0.0
Parameters
product_name
string
Product name.
product
WC_Product
The product object.
cart_item
array
The cart item data.
item_key
string
The item key generated based on the details of the item.
Usage
add_filter( 'cocart_cart_item_name', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_name in repository
cocart_cart_item_removed_message Filter message about item removed from the cart.
Made available since v2.1.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_cart_item_removed_message', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_removed_message in repository
cocart_cart_item_restored_message Filters message about item restored.
Made available since v2.1.0
Parameters
restored_message
string
Message.
Usage
add_filter( 'cocart_cart_item_restored_message', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_restored_message in repository
cocart_cart_item_restored_title Re-calculate totals now an item has been restored.
Made available since v2.1.0
Usage
add_filter( 'cocart_cart_item_restored_title', function() {
    // Your code here
});
Search cocart_cart_item_restored_title in repository
cocart_cart_item_title Filter allows the product title of the item to change.
Made available since v3.0.0
Parameters
product_title
string
Product title.
product
WC_Product
The product object.
cart_item
array
The cart item data.
item_key
string
The item key generated based on the details of the item.
Usage
add_filter( 'cocart_cart_item_title', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_title in repository
cocart_item_added Filter allows additional data to be returned.
Made available since v2.0.0
Parameters
item_added
array
Item added to cart.
item_key
string
Item key of the item added.
Usage
add_filter( 'cocart_item_added', function() {
    // Your code here
}, 10 );
Search cocart_item_added in repository
cocart_item_product Filter allows you to alter the item product data returned.
Made available since v2.0.0
Parameters
product
WC_Product
The product object.
cart_item
array
The cart item data.
item_key
string
The item key currently looped.
Usage
add_filter( 'cocart_item_product', function() {
    // Your code here
}, 10 );
Search cocart_item_product in repository
cocart_item_removed_message Filters message about item removed from cart.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_item_removed_message', function() {
    // Your code here
}, 10 );
Search cocart_item_removed_message in repository
cocart_item_restored_message Filters message about item already restored to cart.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_item_restored_message', function() {
    // Your code here
}, 10 );
Search cocart_item_restored_message in repository
cocart_item_thumbnail Filters the item thumbnail ID.
Made available since v2.0.0
Parameters
thumbnail_id
integer
Product thumbnail ID.
cart_item
array
Cart item.
item_key
string
Item key.
Usage
add_filter( 'cocart_item_thumbnail', function() {
    // Your code here
}, 10 );
Search cocart_item_thumbnail in repository
cocart_item_thumbnail_size Filters the thumbnail size of the product image.
Made available since v2.0.0
Parameters
removed_item
boolean
Determines if the item in the cart is removed.
Usage
add_filter( 'cocart_item_thumbnail_size', function() {
    // Your code here
}, 10 );
Search cocart_item_thumbnail_size in repository
cocart_item_thumbnail_src Filters the source of the product thumbnail.
Made available since v2.1.0
Parameters
thumbnail_src
string
URL of the product thumbnail.
cart_item
array
Cart item.
item_key
string
Item key.
Usage
add_filter( 'cocart_item_thumbnail_src', function() {
    // Your code here
}, 10 );
Search cocart_item_thumbnail_src in repository
cocart_update_cart_validation Filter allows you to determine if the updated item in cart passed validation.
Made available since v2.1.0
Parameters
cart_valid
boolean
True by default.
item_key
string
Item key.
current_data
array
Product data of the item in cart.
quantity
float
The requested quantity to change to.
Usage
add_filter( 'cocart_update_cart_validation', function() {
    // Your code here
}, 10 );
Search cocart_update_cart_validation in repository
cocart_update_item Filters the update status.
Made available since v2.0.1
Parameters
response
array
Status response.
new_data
array
Cart item.
quantity
integer
Quantity.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_update_item', function() {
    // Your code here
}, 10 );
Search cocart_update_item in repository

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.
Made available since v2.1.0
Parameters
quantity
integer
The original quantity of the item.
product_id
integer
The product ID.
variation_id
integer
The variation ID.
variation
array
The variation data.
cart_item_data
array
The cart item data.
Usage
add_filter( 'cocart_add_to_cart_quantity', function() {
    // Your code here
}, 10 );
Search cocart_add_to_cart_quantity in repository
cocart_add_to_cart_sold_individually_found_in_cart Quantity for sold individual products can be filtered.
Made available since v2.0.13
Usage
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
cocart_add_to_cart_sold_individually_quantity Quantity for sold individual products can be filtered.
Made available since v2.0.13
Usage
add_filter( 'cocart_add_to_cart_sold_individually_quantity', function() {
    // Your code here
});
Search cocart_add_to_cart_sold_individually_quantity in repository
cocart_can_not_increase_quantity_message Filters message about product not being allowed to increase quantity.
Made available since v1.0.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_can_not_increase_quantity_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_increase_quantity_message in repository
cocart_can_not_update_item_message Filters message about can not update item.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_can_not_update_item_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_update_item_message in repository
cocart_cannot_add_product_type_to_cart_message Filters message about product type that cannot be added to the cart.
Made available since v2.1.0
Parameters
message
string
Message.
product_data
WC_Product
The product object.
Usage
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
cocart_cart_item_required_stock_is_not_enough Allows filter if product have enough stock to get added to the cart.
Made available since v2.1.0
Parameters
has_stock
boolean
If have enough stock.
product
WC_Product
The product object.
cart_item
array
Cart item values.
Usage
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
cocart_invalid_variation_data_message Filters message about invalid variation data.
Made available since v2.1.0
Parameters
message
string
Message.
attribute_label
string
Attribute Label.
attribute
array
Allowed values.
Usage
add_filter( 'cocart_invalid_variation_data_message', function() {
    // Your code here
}, 10 );
Search cocart_invalid_variation_data_message in repository
cocart_missing_variation_data_message Filters message about missing variation data.
Made available since v2.1.0
Parameters
message
string
Message.
missing_attributes
string
Number of missing attributes.
missing_attributes
array
List of missing attributes.
Usage
add_filter( 'cocart_missing_variation_data_message', function() {
    // Your code here
}, 10 );
Search cocart_missing_variation_data_message in repository
cocart_product_can_not_add_another_message Filters message about product not being allowed to add another.
Made available since v3.0.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_can_not_add_another_message', function() {
    // Your code here
}, 10 );
Search cocart_product_can_not_add_another_message in repository
cocart_product_cannot_add_to_cart_message Filters message about product cannot be added to cart.
Made available since v2.1.0
Parameters
message
string
Message.
product_data
WC_Product
The product object.
Usage
add_filter( 'cocart_product_cannot_add_to_cart_message', function() {
    // Your code here
}, 10 );
Search cocart_product_cannot_add_to_cart_message in repository
cocart_product_cannot_be_added_message Filters message about product that cannot be added to cart.
Made available since v3.0.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_cannot_be_added_message', function() {
    // Your code here
}, 10 );
Search cocart_product_cannot_be_added_message in repository
cocart_product_cannot_be_purchased_message Filters message about product unable to be purchased.
Made available since v2.1.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_cannot_be_purchased_message', function() {
    // Your code here
}, 10 );
Search cocart_product_cannot_be_purchased_message in repository
cocart_product_does_not_exist_message Filters message about product does not exist.
Made available since v2.1.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_does_not_exist_message', function() {
    // Your code here
}, 10 );
Search cocart_product_does_not_exist_message in repository
cocart_product_failed_validation_message Filters message about product failing validation.
Made available since v1.0.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_failed_validation_message', function() {
    // Your code here
}, 10 );
Search cocart_product_failed_validation_message in repository
cocart_product_is_out_of_stock_message Filters message about product is out of stock.
Made available since v2.1.0
Parameters
message
string
Message.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_product_is_out_of_stock_message', function() {
    // Your code here
}, 10 );
Search cocart_product_is_out_of_stock_message in repository
cocart_product_not_enough_stock_message Filters message about product not having enough stock.
Made available since v3.1.0
Parameters
message
string
Message.
product
WC_Product
The product object.
stock_quantity
integer
Quantity remaining.
Usage
add_filter( 'cocart_product_not_enough_stock_message', function() {
    // Your code here
}, 10 );
Search cocart_product_not_enough_stock_message in repository
cocart_quantity_maximum_allowed Filters the products maximum quantity allowed to be purchased.
Made available since v3.1.0
Usage
add_filter( 'cocart_quantity_maximum_allowed', function() {
    // Your code here
});
Search cocart_quantity_maximum_allowed in repository
cocart_quantity_minimum_requirement Filters the minimum quantity requirement the product allows to be purchased.
Made available since v3.1.0
Usage
add_filter( 'cocart_quantity_minimum_requirement', function() {
    // Your code here
});
Search cocart_quantity_minimum_requirement in repository
cocart_skip_woocommerce_item_validation Filter the item to skip product validation as it is added to cart.
Made available since v3.0.0
Parameters
validate_product
boolean
Whether to validate the product or not.
product_data
array
Contains the product data of the product to add to cart.
product_id
integer
The product ID.
Usage
add_filter( 'cocart_skip_woocommerce_item_validation', function() {
    // Your code here
}, 10 );
Search cocart_skip_woocommerce_item_validation in repository

Session & Customer Management

This category contains filters for session handling, customer data, and cart loading behavior. cocart_disable_load_cart Filter checks if feature is disabled.
Made available since v3.0.0
Returns: bool Usage
add_filter( 'cocart_disable_load_cart', function() {
    // Your code here
});
Search cocart_disable_load_cart in repository
cocart_load_cart_query_name Filter allows developers to add more white labelling when loading the cart via web.
Made available since v2.8.2
Parameters
action_query
string
Default is ‘cocart-load-cart’.
Usage
add_filter( 'cocart_load_cart_query_name', function() {
    // Your code here
}, 10 );
Search cocart_load_cart_query_name in repository
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.
Made available since v4.2.0
Usage
add_filter( 'cocart_requested_cart_key', function() {
    // Your code here
});
Search cocart_requested_cart_key in repository
cocart_set_customer_id Filter allows to set the customer ID.
Made available since v4.1.0
Parameters
current_user_id
integer
Current user ID.
Usage
add_filter( 'cocart_set_customer_id', function() {
    // Your code here
}, 10 );
Search cocart_set_customer_id in repository

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”.
Made available since v2.1.0
Usage
add_filter( 'cocart_prepare_money_disable_decimals', function() {
    // Your code here
});
Search cocart_prepare_money_disable_decimals in repository
cocart_prepare_product_attribute Filter a attribute item returned from the API. Allows modification of the product attribute data right before it is returned.
Made available since v2.1.0
Parameters
response
WP_REST_Response
The response object.
item
object
The original attribute object.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_prepare_product_attribute', function() {
    // Your code here
}, 10 );
Search cocart_prepare_product_attribute in repository
cocart_prepare_product_object Filter the data for a response.
Made available since v2.1.0
Parameters
response
WP_REST_Response
The response object.
product
WC_Product
The product object.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_prepare_product_object', function() {
    // Your code here
}, 10 );
Search cocart_prepare_product_object in repository
cocart_price_no_html Filters the string of price markup.
Made available since v2.1.0
Parameters
return
string
Price HTML markup.
price
string
Formatted price.
args
array
Pass on the args.
unformatted_price
float
Price as float to allow plugins custom formatting. Since 3.2.0.
original_price
float|string
Original price as float, or empty string. Since 5.0.0.
Usage
add_filter( 'cocart_price_no_html', function() {
    // Your code here
}, 10 );
Search cocart_price_no_html in repository
cocart_product_title Filters the product title in cart.
Made available since v2.1.0
Parameters
product_title
string
Product title.
product
WC_Product
The product object.
cart_item
array
Cart item.
item_key
string
Item key.
Usage
add_filter( 'cocart_product_title', function() {
    // Your code here
}, 10 );
Search cocart_product_title in repository
cocart_products_add_to_cart_rest_url Filters the REST URL shortcut for adding the product to cart.
Made available since v3.1.0
Parameters
rest_url
string
REST URL for adding product to the cart.
product
WC_Product
The product object.
type
string
Product type.
id
integer
Product ID.
Usage
add_filter( 'cocart_products_add_to_cart_rest_url', function() {
    // Your code here
}, 10 );
Search cocart_products_add_to_cart_rest_url in repository
cocart_products_get_price_range Filters the products price range.
Made available since v3.1.0
Parameters
price
array
The current product price range.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_products_get_price_range', function() {
    // Your code here
}, 10 );
Search cocart_products_get_price_range in repository
cocart_products_get_safe_meta_data Filter allows you to control what remaining product meta data is safe to return.
Made available since v3.11.0
Parameters
safe_meta
array
Safe meta.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_products_get_safe_meta_data', function() {
    // Your code here
}, 10 );
Search cocart_products_get_safe_meta_data in repository
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!
Made available since v3.11.0
Parameters
ignored_meta_keys
array
Ignored meta keys.
product
WC_Product
The product object.
Usage
add_filter( 'cocart_products_ignore_private_meta_keys', function() {
    // Your code here
}, 10 );
Search cocart_products_ignore_private_meta_keys in repository
cocart_products_variable_empty_price Filter the variable products empty prices.
Made available since v3.1.0
Parameters
empty_prices
array
Empty array.
product
WC_Product
The project object.
Usage
add_filter( 'cocart_products_variable_empty_price', function() {
    // Your code here
}, 10 );
Search cocart_products_variable_empty_price in repository

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.
Made available since v4.1.0
Parameters
allow_change
boolean
Allow price change.
cart_item
array
Cart item.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_does_product_allow_price_change', function() {
    // Your code here
}, 10 );
Search cocart_does_product_allow_price_change in repository
cocart_is_rest_api_request Filters the REST API requested.
Made available since v2.1.0
Parameters
is_rest_api_request
boolean
True if CoCart REST API is requested.
Usage
add_filter( 'cocart_is_rest_api_request', function() {
    // Your code here
}, 10 );
Search cocart_is_rest_api_request in repository
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.
Made available since v3.0.0
Usage
add_filter( 'cocart_return_default_response', function() {
    // Your code here
});
Search cocart_return_default_response in repository
cocart_totals_calculated_message Filters message about cart totals have been calculated.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_totals_calculated_message', function() {
    // Your code here
}, 10 );
Search cocart_totals_calculated_message in repository

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.
Made available since v3.1.0
Usage
add_filter( 'cocart_enable_setup_wizard', function() {
    // Your code here
});
Search cocart_enable_setup_wizard in repository
cocart_get_plugins_for_cocart Filter allows you to get plugins which “maybe” are for CoCart.
Made available since v4.3.0
Parameters
matches
array
Array of plugins that “maybe” are for CoCart.
plugins
array
Array of plugins installed.
Usage
add_filter( 'cocart_get_plugins_for_cocart', function() {
    // Your code here
}, 10 );
Search cocart_get_plugins_for_cocart in repository
cocart_get_plugins_with_header Filter allows you to get the plugins that have a valid value for a specific header.
Made available since v4.3.0
Parameters
matches
array
Array of plugins matched with header.
header
string
Plugin header to search for.
plugins
array
Array of plugins installed.
Usage
add_filter( 'cocart_get_plugins_with_header', function() {
    // Your code here
}, 10 );
Search cocart_get_plugins_with_header in repository
cocart_in_plugin_update_message Filter allows you to change the upgrade notice.
Made available since v4.3.0
Usage
add_filter( 'cocart_in_plugin_update_message', function() {
    // Your code here
});
Search cocart_in_plugin_update_message in repository
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() )
Made available since v3.10.0
Parameters
submenus
array
Array of submenu pages.
Usage
add_filter( 'cocart_register_submenu_page', function() {
    // Your code here
}, 10 );
Search cocart_register_submenu_page in repository
cocart_show_plugin_search Filter if should be active.
Made available since v4.1.0
Parameters
show_suggestions
boolean
True if CoCart Plugin Suggestions is active.
Usage
add_filter( 'cocart_show_plugin_search', function() { return false; });
Search cocart_show_plugin_search in repository

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.
Made available since v3.1.0
Usage
add_filter( 'cocart_add_item_query_parameters', function() {
    // Your code here
});
Search cocart_add_item_query_parameters in repository
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.
Made available since v3.1.0
Usage
add_filter( 'cocart_add_items_query_parameters', function() {
    // Your code here
});
Search cocart_add_items_query_parameters in repository
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.
Made available since v3.1.0
Usage
add_filter( 'cocart_cart_items_schema', function() {
    // Your code here
});
Search cocart_cart_items_schema in repository
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.
Made available since v3.1.0
Usage
add_filter( 'cocart_cart_query_parameters', function() {
    // Your code here
});
Search cocart_cart_query_parameters in repository
cocart_prevent_wc_admin_note_created Filter to prevent note from being created.
Made available since v3.2.0
Parameters
prevent_note_creation
boolean
False by default.
args
array
Arguments to create the note.
Usage
add_filter( 'cocart_prevent_wc_admin_note_created', function() {
    // Your code here
}, 10 );
Search cocart_prevent_wc_admin_note_created in repository
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.
Made available since v2.1.0
Parameters
response
WP_REST_Response
Response data.
Usage
add_filter( 'cocart_store_index', function() {
    // Your code here
}, 10 );
Search cocart_store_index in repository

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.
Made available since v2.1.0
Parameters
prepared_review
array|WP_Error
The prepared review data for wp_insert_comment().
request
WP_REST_Request
Full details about the request.
Usage
add_filter( 'cocart_pre_insert_product_review', function() {
    // Your code here
}, 10 );
Search cocart_pre_insert_product_review in repository
cocart_prepare_product_review Filter product reviews object returned from the REST API.
Made available since v2.1.0
Parameters
response
WP_REST_Response
The response object.
review
WP_Comment
Product review object used to create response.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_prepare_product_review', function() {
    // Your code here
}, 10 );
Search cocart_prepare_product_review in repository
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.
Made available since v2.1.0
Parameters
prepared_review
array
The prepared review data for wp_insert_comment.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_preprocess_product_review', function() {
    // Your code here
}, 10 );
Search cocart_preprocess_product_review in repository
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.
Made available since v2.1.0
Parameters
params
array
JSON Schema-formatted collection parameters.
Usage
add_filter( 'cocart_product_review_collection_params', function() {
    // Your code here
}, 10 );
Search cocart_product_review_collection_params in repository
cocart_product_review_query Filters arguments, before passing to WP_Comment_Query, when querying reviews via the REST API.
Made available since v2.1.0
Parameters
prepared_args
array
Array of arguments for WP_Comment_Query.
request
WP_REST_Request
The request object.
Usage
add_filter( 'cocart_product_review_query', function() {
    // Your code here
}, 10 );
Search cocart_product_review_query in repository

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.
Made available since v4.1.0
Parameters
packages
array
Available shipping packages.
chosen_method
array
Chosen shipping method.
Usage
add_filter( 'cocart_available_shipping_packages', function() {
    // Your code here
}, 10 );
Search cocart_available_shipping_packages in repository
cocart_shipping_package_details_array Filter allows you to change the package details.
Made available since v3.0.0
Parameters
product_names
array
Product names.
package
array
Package details.
Usage
add_filter( 'cocart_shipping_package_details_array', function() {
    // Your code here
}, 10 );
Search cocart_shipping_package_details_array in repository
cocart_shipping_package_name Filters the package name for the shipping method.
Made available since v3.0.0
Parameters
shipping_name
string
Shipping name.
Usage
add_filter( 'cocart_shipping_package_name', function() {
    // Your code here
}, 10 );
Search cocart_shipping_package_name in repository

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.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_can_not_remove_item_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_remove_item_message in repository
cocart_can_not_restore_item_message Filters message about can not restore item.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_can_not_restore_item_message', function() {
    // Your code here
}, 10 );
Search cocart_can_not_restore_item_message in repository
cocart_cart_item_key_required_message Filters message about cart item key required.
Made available since v2.1.0
Parameters
message
string
Message.
status
string
Status of which we are checking the item key.
Usage
add_filter( 'cocart_cart_item_key_required_message', function() {
    // Your code here
}, 10 );
Search cocart_cart_item_key_required_message in repository
cocart_item_not_in_cart_message Filters message about cart item key required.
Made available since v2.1.0
Parameters
message
string
Message.
method
string
Method.
Usage
add_filter( 'cocart_item_not_in_cart_message', function() {
    // Your code here
}, 10 );
Search cocart_item_not_in_cart_message in repository
cocart_no_items_in_cart_message Filters message about no items in the cart.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_no_items_in_cart_message', function() {
    // Your code here
}, 10 );
Search cocart_no_items_in_cart_message in repository
cocart_no_items_message Filters message about no items in cart.
Made available since v2.1.0
Parameters
message
string
Message.
Usage
add_filter( 'cocart_no_items_message', function() {
    // Your code here
}, 10 );
Search cocart_no_items_message in repository
I