Developer Hooks

NOTE!

This is a work in process, and does not outline all current hooks. We will provide documentation for our development hooks in time. Until that point, you can search for "hook" in the CartThrob code. There are roughly 25 development hooks in the module, extension, and control panel files. Please post in the forums if you require a hook that is currently not available.

Hooks

cartthrob_delete_from_cart_start

Additional processing when a delete from cart action begins.

return void

cartthrob_delete_from_cart_end

Additional processing when a delete from cart action is about to end.

return void

cartthrob_add_to_cart_start

Additional processing when add to cart action begins. Item has not been added yet.

return void

cartthrob_add_to_cart_end

Additional processing when add to cart action ends. At this point the item data has been aggregated into an item object

$item (object)

return void

cartthrob_update_cart_start

Additional processing when update cart action begins.

return void

cartthrob_update_cart_end

Additional processing when update cart action ends.

return void

cartthrob_multi_add_to_cart_start

Additional cart processing when multi add to cart action begins

return void

cartthrob_multi_add_to_cart_end

Additional cart processing when multi add to cart action is about to end.

$entry_ids (array)

return void

cartthrob_save_customer_info_start

Additional processing when save customer info action is about to start. This may be called multiple times during other processing actions.

return void

cartthrob_save_customer_info_end

Additional processing when save customer info action is about to end. This may be called multiple times during other processing actions.

return void

cartthrob_pre_process

When checkout form is submitted, but before the data is sent to the payment gateway file.

return void

cartthrob_on_authorize

Additional processing when the payment has been authorized.

return void

cartthrob_on_decline

Additional processing when the payment has been declined

return void

cartthrob_on_processing

Additional processing when the payment has been marked as "processing"

return void

cartthrob_on_fail

Additional processing when the payment has been marked as "failed"

return void

cartthrob_create_member

Called during checkout if you are attempting to create a member during checkout. If you want to modify the $this object remember to use a reference (&) on the function call.

$member_data (array)
&$this (object)

return void

cartthrob_discount_filter

$filter (array)

return $filter (array)

cart_discount_start

Adjusts the criteria used to pull relevant discount entries from the discounts channel

return $discount (float)

cart_total_start

Manipulates the cart total

return $total (float)

cart_tax_end

Manipulates the cart tax

$tax (float)

return $tax (float)

cart_shipping_end

Manipulates cart shipping costs

$shipping (float)

return $shipping (float)

inventory_matching_items

Returns items similar to product

$product_id (string)
$item_options (array)

return $items (object)

product_meta

Adds meta data to a product in the cart.

$product (Cartthrob_product object)
$field_id (string)

return $data (string)

product_inventory

Manipulate item inventory

$product(Cartthrob_product object)
$item_options (array)

return $inventory (int)

product_reduce_inventory

Manipulates product inventory, and sends low inventory emails if applicable

because of the way hooks work, and how we call this in the process_inventory method above item_options are the first arg in args ($args[0])

$product(Cartthrob_product object)
$quantity (int)
$args (array)

return void

product_price

Modifies product price

$product (Cartthrob_product object)
$item = FALSE (Cartthrob_item object)

return $price (float)

cartthrob_get_all_price_modifiers

Manipulates price modifiers dynamically.

$entry_id

returns $price_modifiers (array)

cartthrob_calculate_total

Adjusts total

return $total (float)

cartthrob_calculate_discount

Adjusts discount

return $discount (float)

cartthrob_calculate_shipping

Adjusts shipping

$shipping (float)

return (float)

cartthrob_calculate_tax

Adjusts tax

$tax (float)

return $tax (float)

cartthrob_calculate_item_shipping

Adjusts shipping per item

$shipping (float)

return $shipping (float)

cartthrob_add_settings_nav

Adds navigation items to the CT settings. Should be used with cartthrob_add_settings_views

$nav (array)

return $nav (array)

cartthrob_add_settings_views

Adds settings items to the CT settings. Should be used with cartthrob_add_settings_nav

$settings_views (array)

return $settings_views (array)

cartthrob_download_start

Additional processing when add to download action begins. Download has not started, and path has not been identified.

return void

cartthrob_download_end

Allows additional manipulation of the download file path

$path (string)

return $path (string)

cartthrob_view_converted_currency

Allows additional processing for currency conversion

$number (float)

return $number (float)

Top of Page