Installation Hooks
cocart_init
Fires once CoCart has finished loading.
Made available since v3.0.0
includes/class-cocart.php
cocart_updated
Runs after CoCart has been updated.
Made available since v1.2.0
includes/classes/class-cocart-install.php
cocart_installed
Runs after CoCart has been installed.
Made available since v1.2.0
includes/classes/class-cocart-install.php
Cart Updates
cocart_update_cart_before_totals
Fires before the cart has updated via a callback, but before cart totals are re-calculated.
Parameters
WP_REST_Request
The request object.
object
The cart controller.
Made available since v4.1.0
includes/abstracts/abstract-cocart-extension-callback.php
cocart_update_cart_after_totals
Fires after the cart has updated via a callback and cart totals are re-calculated.
Parameters
WP_REST_Request
The request object.
object
The cart controller.
Made available since v4.1.0
Session Hooks
cocart_after_session_saved_data
Fires after session data is saved.
Parameters
int
Customer ID.
array
Cart data.
int
Cart expiration.
string
Cart source.
Made available since v4.2.0
cocart_cart_loaded
Fires once a cart has loaded. Can be used to trigger a webhook.
Parameters
string
The cart key.
Made available since v3.8.0
Cart Items Management
cocart_item_added_updated_in_cart
Fires if item was added again to the cart but updated the quantity.
Parameters
string
Item key of the item added again.
array
Item added to cart again.
int
New quantity of the item.
Made available since v2.1.0
cocart_item_added_to_cart
Fires once an item has been added to cart.
Parameters
string
Item key of the item added.
array
Item added to cart.
Made available since v2.1.0
cocart_item_removed
Fires when an item is removed from the cart.
Parameters
array
The cart item data.
Made available since v2.0.0
cocart_item_restored
Fires when an item is restored to the cart.
Parameters
array
The cart item data.
Made available since v2.0.0
cocart_item_quantity_changed
Fires when the quantity of an item in the cart is changed.
Parameters
string
Item key.
array
Item data.
Made available since v2.0.0
Product Reviews
cocart_insert_product_review
Fires after a comment is created via the REST API.
Parameters
WP_Comment
Inserted comment object.
WP_REST_Request
The request object.
bool
True when creating a comment, false when updating.
Made available since v2.1.0