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 Point | Purpose |
|---|---|
catalog/controller/common/footer/aftercode: simpler | Renders the Simpler checkout button on the page. |
catalog/controller/common/header/aftercode: simpler | Injects the Simpler SDK script into the page head. |
catalog/view/common/cart/aftercode: simpler | Adds the Simpler button to the minicart. |
catalog/controller/checkout/checkout/beforecode: simpler_caas | Redirects to hosted checkout when CaaS is enabled. |
catalog/controller/extension/quickcheckout/checkout/beforecode: simpler_caas_quick | Same as above, for quick checkout extensions. |
catalog/model/checkout/order/addOrder/aftercode: simpler_caas_order_saved | Reports the completed order back to Simpler. |
catalog/controller/checkout/success/beforecode: simpler_caas_success | Resets the checkout state after an order completes. |
Triggered Events
The following events are triggered by the extension.
| Trigger Point | Arguments | Purpose |
|---|---|---|
extension/module/simpler/metadata/build | array &$metadata | Collects metadata to send to Simpler when the checkout is rendered. |
extension/module/simpler/metadata/apply | array $metadata | Receives 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:
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:
// 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:
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:
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.
}
}
The same pattern works for other API endpoints. Replace v1/submit with v1/quote, v1/products, or v1/feed to hook into those flows.