Skip to main content

Events

The Simpler Checkout extension registers OpenCart events that you can hook into for custom integrations.

Registered Events​

The following events are registered during installation.

Trigger PointPurpose
catalog/controller/common/footer/after
code: simpler
Renders the Simpler checkout button on the page.
catalog/controller/common/header/after
code: simpler
Injects the Simpler SDK script into the page head.
catalog/view/common/cart/after
code: simpler
Adds the Simpler button to the minicart.
catalog/controller/checkout/checkout/before
code: simpler_caas
Redirects to hosted checkout when CaaS is enabled.
catalog/controller/extension/quickcheckout/checkout/before
code: simpler_caas_quick
Same as above, for quick checkout extensions.
catalog/model/checkout/order/addOrder/after
code: simpler_caas_order_saved
Reports the completed order back to Simpler.
catalog/controller/checkout/success/before
code: simpler_caas_success
Resets the checkout state after an order completes.

Triggered Events​

The following events are triggered by the extension.

Trigger PointArgumentsPurpose
extension/module/simpler/metadata/buildarray &$metadataCollects metadata to send to Simpler when the checkout is rendered.
extension/module/simpler/metadata/applyarray $metadataReceives the metadata sent back by Simpler on quote and submit.

Add Custom Metadata​

Listen to the metadata events to pass custom data through the Simpler checkout and read it back when Simpler calls your store.

Register the events in your module's install() method:

admin/controller/extension/module/mymodule.php
public function install() {
$this->load->model('setting/event');
$this->model_setting_event->addEvent(
'mymodule_metadata_build_listener',
'catalog/extension/module/simpler/metadata/build',
'extension/module/mymodule/onSimplerMetadataBuild'
);
$this->model_setting_event->addEvent(
'mymodule_metadata_apply_listener',
'catalog/extension/module/simpler/metadata/apply',
'extension/module/mymodule/onSimplerMetadataApply'
);
}

Handle the events in your catalog controller:

catalog/controller/extension/module/mymodule.php
// Add metadata to Simpler payload
public function onSimplerMetadataBuild(&$metadata) {
$metadata['user_ip'] = $this->request->server['REMOTE_ADDR'] ?? null;
}

// Apply metadata on Simpler requests (quote/submit) before any action is taken
public function onSimplerMetadataApply($metadata) {
$ip = $metadata['user_ip'] ?? null;
// place your logic here
}

Hooking Into Order Submission​

Register your own after event on the submit endpoint to run custom logic when an order is created through Simpler.

Register the event in your module's install() method:

admin/controller/extension/module/mymodule.php
public function install()
{
$this->load->model('setting/event');
$this->model_setting_event->addEvent(
'mymodule_simpler_listener',
'catalog/controller/extension/module/simpler/v1/submit/after',
'extension/module/mymodule/onSimplerOrder'
);
}

Handle the event in your catalog controller:

catalog/controller/extension/module/mymodule.php
public function onSimplerOrder($route, $args, $output)
{
// $output contains the JSON response string from the submit endpoint.
// Decode it to access order_id and request_id.
$data = json_decode($output, true);

if (isset($data['order_id'])) {
$order_id = $data['order_id'];
// Your custom logic here — e.g., sync to ERP, send notifications, etc.
}
}
info

The same pattern works for other API endpoints. Replace v1/submit with v1/quote, v1/products, or v1/feed to hook into those flows.