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
string
Origin URL if allowed, empty string if not.
Usage
Search cocart_allow_origin in repository
cocart_auth_header Filter allows you to change the authorization header.
Made available since v4.1.0
Parameters
string
Authorization header.
Usage
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
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
string
Capability level.
Usage
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
array
The extra information.
object
The current user.
Usage
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
boolean
Whether to send no-cache headers.
Usage
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
string
Message.
Usage
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
array
Cart contents.
string
Item key.
array
Cart item.
WC_Product
The product object.
Usage
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
int
Expiration.
boolean
If user is logged in. @since v4.4.0
Usage
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
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
array
Array of items in the cart.
string
The item key currently looped.
array
The cart item data.
WC_Product
The product object.
Usage
Search cocart_cart_items in repository
cocart_cart_source Filter source of cart.
Made available since v3.0.0
Usage
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
string
Message.
Usage
Search cocart_clear_cart_failed_message in repository
cocart_cross_sells Filters the cross sell items.
Made available since v3.0.0
Parameters
WP_REST_Request
The request object.
Usage
Search cocart_cross_sells in repository
cocart_empty_cart Filter response for empty cart.
Made available since v3.0.0
Usage
Search cocart_empty_cart in repository
cocart_filter_request_data Filters additional requested data.
Made available since v3.0.0
Usage
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
array
Details of the item in the cart if it exists.
string
Condition of item. Default: “add”, Option: “add”, “remove”, “restore”, “update”.
Usage
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
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
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
Search cocart_return_cart_session_contents in repository
cocart_return_empty_cart Filter response for empty cart.
Made available since v2.0.8
Usage
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
string
Message.
Usage
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
string
Message.
Usage
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
array
The cart item data.
string
Generated ID based on the product information when added to the cart.
Usage
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
string
Message.
string
Status of which we are checking the item key.
Usage
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
string
Product name.
WC_Product
The product object.
array
The cart item data.
string
The item key generated based on the details of the item.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
Usage
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
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
string
Product title.
WC_Product
The product object.
array
The cart item data.
string
The item key generated based on the details of the item.
Usage
Search cocart_cart_item_title in repository
cocart_item_added Filter allows additional data to be returned.
Made available since v2.0.0
Parameters
array
Item added to cart.
string
Item key of the item added.
Usage
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
WC_Product
The product object.
array
The cart item data.
string
The item key currently looped.
Usage
Search cocart_item_product in repository
cocart_item_removed_message Filters message about item removed from cart.
Made available since v2.1.0
Parameters
string
Message.
Usage
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
string
Message.
Usage
Search cocart_item_restored_message in repository
cocart_item_thumbnail Filters the item thumbnail ID.
Made available since v2.0.0
Parameters
integer
Product thumbnail ID.
array
Cart item.
string
Item key.
Usage
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
boolean
Determines if the item in the cart is removed.
Usage
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
string
URL of the product thumbnail.
array
Cart item.
string
Item key.
Usage
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
boolean
True by default.
string
Item key.
array
Product data of the item in cart.
float
The requested quantity to change to.
Usage
Search cocart_update_cart_validation in repository
cocart_update_item Filters the update status.
Made available since v2.0.1
Parameters
array
Status response.
array
Cart item.
integer
Quantity.
WC_Product
The product object.
Usage
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
integer
The original quantity of the item.
integer
The product ID.
integer
The variation ID.
array
The variation data.
array
The cart item data.
Usage
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
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
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
boolean
If have enough stock.
WC_Product
The product object.
array
Cart item values.
Usage
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
string
Message.
string
Attribute Label.
array
Allowed values.
Usage
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
string
Message.
string
Number of missing attributes.
array
List of missing attributes.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
Usage
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
string
Message.
WC_Product
The product object.
integer
Quantity remaining.
Usage
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
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
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
boolean
Whether to validate the product or not.
array
Contains the product data of the product to add to cart.
integer
The product ID.
Usage
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
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
string
Default is ‘cocart-load-cart’.
Usage
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
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
integer
Current user ID.
Usage
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
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
WP_REST_Response
The response object.
object
The original attribute object.
WP_REST_Request
The request object.
Usage
Search cocart_prepare_product_attribute in repository
cocart_prepare_product_object Filter the data for a response.
Made available since v2.1.0
Parameters
WP_REST_Response
The response object.
WC_Product
The product object.
WP_REST_Request
The request object.
Usage
Search cocart_prepare_product_object in repository
cocart_price_no_html Filters the string of price markup.
Made available since v2.1.0
Parameters
string
Price HTML markup.
string
Formatted price.
array
Pass on the args.
float
Price as float to allow plugins custom formatting. Since 3.2.0.
float|string
Original price as float, or empty string. Since 5.0.0.
Usage
Search cocart_price_no_html in repository
cocart_product_title Filters the product title in cart.
Made available since v2.1.0
Parameters
string
Product title.
WC_Product
The product object.
array
Cart item.
string
Item key.
Usage
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
string
REST URL for adding product to the cart.
WC_Product
The product object.
string
Product type.
integer
Product ID.
Usage
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
array
The current product price range.
WC_Product
The product object.
Usage
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
array
Safe meta.
WC_Product
The product object.
Usage
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
array
Ignored meta keys.
WC_Product
The product object.
Usage
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
array
Empty array.
WC_Product
The project object.
Usage
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
boolean
Allow price change.
array
Cart item.
WP_REST_Request
The request object.
Usage
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
boolean
True if CoCart REST API is requested.
Usage
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
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
string
Message.
Usage
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
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
array
Array of plugins that “maybe” are for CoCart.
array
Array of plugins installed.
Usage
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
array
Array of plugins matched with header.
string
Plugin header to search for.
array
Array of plugins installed.
Usage
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
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
array
Array of submenu pages.
Usage
Search cocart_register_submenu_page in repository
cocart_show_plugin_search Filter if should be active.
Made available since v4.1.0
Parameters
boolean
True if CoCart Plugin Suggestions is active.
Usage
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
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
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
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
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
boolean
False by default.
array
Arguments to create the note.
Usage
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
WP_REST_Response
Response data.
Usage
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
array|WP_Error
The prepared review data for wp_insert_comment().
WP_REST_Request
Full details about the request.
Usage
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
WP_REST_Response
The response object.
WP_Comment
Product review object used to create response.
WP_REST_Request
The request object.
Usage
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
array
The prepared review data for wp_insert_comment.
WP_REST_Request
The request object.
Usage
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
array
JSON Schema-formatted collection parameters.
Usage
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
array
Array of arguments for WP_Comment_Query.
WP_REST_Request
The request object.
Usage
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
array
Available shipping packages.
array
Chosen shipping method.
Usage
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
array
Product names.
array
Package details.
Usage
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
string
Shipping name.
Usage
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
string
Message.
Usage
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
string
Message.
Usage
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
string
Message.
string
Status of which we are checking the item key.
Usage
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
string
Message.
string
Method.
Usage
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
string
Message.
Usage
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
string
Message.
Usage
Search cocart_no_items_message in repository