Extension Hooks

Exp:resso Store contains extension hooks at useful places in our code. This enables you to build your own software on top of Store, without needing to modify core files.

The following hooks are provided. To fully understand how to use them, you will need to look at exactly where they are called in our code. You will then be able to modify or replace the standard functionality in Store.

Note that most hooks are called on form submissions (POST actions), so you will not normally have access to the EE template libraries or be able to affect the display of a page. If you need to change the display of the front end of your website, you should probably create a simple plugin instead of using these extension hooks.

Order Update Hooks

These hooks are called during update of the order. This happens any time a new item is added to the cart, or the customer updates their cart details.


ee()->extensions->call('store_order_item_add_start', $order, $item_attributes, $form_params);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_order_item_add_end', $order, $item, $item_attributes, $form_params);


ee()->extensions->call('store_order_recalculate_start', $order);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_order_item_recalculate_start', $order, $item);
if (ee()->extensions->end_script) continue;


ee()->extensions->call('store_order_item_recalculate_end', $order, $item);


ee()->extensions->call('store_order_recalculate_end', $order);


$adjusters = ee()->extensions->call('store_order_adjusters', $adjusters);


ee()->extensions->call('store_order_empty_cart', $old_cart);

Order Completion Hooks

These hooks are called when the order is completed. This happens once a payment has been made, and the cart is converted into an order. This will only ever happen once per order, so is an ideal time to nofity third party systems about the order.


ee()->extensions->call('store_order_complete_start', $order);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_order_complete_end', $order);

Order Status Hooks

These hooks are called when the order status is changed. Note that the first time this hook is called is when the order is marked as complete, and transitioned to the New status.


ee()->extensions->call('store_order_update_status_start', $order, $status, $member_id, $message);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_order_update_status_end', $order, $status, $history, $member_id, $message);

Transaction Hooks

These hooks are called when a payment request is submitted to the gateway


ee()->extensions->call('store_payment_request_start', $request, $transaction);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_payment_request_end', $request, $transaction);
if (ee()->extensions->end_script) return;

These hooks are called during transaction processing (i.e. after a payment has been submitted).


ee()->extensions->call('store_transaction_update_start', $transaction, $response);
if (ee()->extensions->end_script) return;


ee()->extensions->call('store_transaction_update_end', $transaction, $response);

Payment Hooks

This hook is called in the Store control panel when detecting the installed payment gateways. It can be used by extensions to add additional gateways.


$gateways = ee()->extensions->call('store_payment_gateways', $gateways);

Shipping Hooks

This hook is called while the cart is processing, to get a list of available shipping methods. You can add to the $options array, and the shipping methods will be displayed to the customer.


$options = ee()->extensions->call('store_order_shipping_methods', $order, $options);

Tax Hooks

This hook is called while the cart is processing, to get a list of available tax rates applicable to the order. You can add to the $taxes array, and the taxes will be charged accordingly.

$taxes = ee()->extensions->call('store_order_taxes', $order, $taxes);

Reporting Hooks

This hook is called from the control panel reports page, to get a list of available reports. You can add to the $reports array, and the new reports will be displayed in the control panel.

$reports = ee()->extensions->call('store_reports', $reports);