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.

Control Panel Hooks

store_orders_datatable

Added: 1.2.1

Modify the control panel orders datatable.

$response = $this->EE->extensions->call('store_orders_datatable', $response);

store_inventory_datatable

Added: 1.2.1

Modify the control panel inventory datatable.

$response = $this->EE->extensions->call('store_inventory_datatable', $response);

Cart Hooks

store_cart_update_start

Added: 1.6.2

Modify the cart array before the cart is updated.

$this->cart_contents = $this->EE->extensions->call('store_cart_update_start', $this->cart_contents, $update_data);

store_cart_update_end

Added: 1.2.0

Modify the cart array when the cart is updated.

$this->cart_contents = $this->EE->extensions->call('store_cart_update_end', $this->cart_contents);

store_cart_item_update

Added: 1.2.0

$this->cart_contents = $this->EE->extensions->call('store_cart_item_update', $this->cart_contents);

store_cart_item_update_end

Added: 1.5.0

Modify a cart item when the cart is updated.

$item = $this->EE->extensions->call('store_cart_item_update_end', $item);

store_process_product_tax

Added: 1.2.0

Modify a product before it is displayed to the user.

$product = $this->EE->extensions->call('store_process_product_tax', $product);

store_cart_update_tax_rate

Adjust the current tax rate when the cart is updated

$this->cart_contents = $this->EE->extensions->call('store_cart_update_tax_rate', $this->cart_contents, $tax);

Order Hooks

store_order_complete_start

Added: 1.5.0

Extra processing before an order is completed.

$order = $this->extensions->call('store_order_complete_start', $order);
if ($this->extensions->end_script === TRUE) return $order;

store_order_complete_end

Added: 1.5.0

Extra processing after an order has been completed. If you need to run custom code every time an order is successfully submitted, this is usually the correct hook to use.

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

store_order_submit_start

Added: 1.4.0

Modify an order before it is submitted.

$order = $this->extensions->call('store_order_submit_start', $order);
if ($this->extensions->end_script === TRUE) return $order;

store_order_submit_end

Added: 1.4.0

Extra processing after an order has been submitted.

$order = $this->extensions->call('store_order_submit_end', $order);

store_order_payment_start

Added: 1.4.0

Modify a payment before it is submitted.

$payment = $this->extensions->call('store_order_payment_start', $order, $payment);
if ($this->extensions->end_script) return TRUE;

store_order_payment_end

Added: 1.4.0

Extra processing after a payment has been submitted.

$this->extensions->call('store_order_payment_end', $order, $payment);