Developer Portal

Cafetito Hooks 107 hooks

100+ hooks for customizing donations, payments, emails, and display in Cafetito.

Cafetito · WordPress plugin Developer Portal View plugin
0 hooks shown

Lifecycle 5

cafetito_loadedAction

Fires once the plugin has finished bootstrapping and all of its components are loaded. This is the recommended moment for add-ons to register their own gateways, settings, or callbacks against Cafetito, because the container and registries are ready at this point.

Parameters
NameTypeDescription
$plugin`Cafetito\Plugin`The main plugin instance, giving access to its registries and services.

Source: includes/Plugin.php:122

PHP
add_action( 'cafetito_loaded', function ( $plugin ) {
    // The plugin is fully initialized here.
    error_log( 'Cafetito is ready.' );
}, 10, 1 );
cafetito_activatedAction

Fires when the plugin is activated, after the installer has created or upgraded the database tables and registered capabilities. Use it to seed default options or run one-time activation tasks for your extension.

Source: includes/Installer.php:36

PHP
add_action( 'cafetito_activated', function () {
    add_option( 'my_addon_installed_at', time() );
} );
cafetito_deactivatedAction

Fires when the plugin is deactivated, after Cafetito has performed its own cleanup of scheduled events. Use it to clear your add-on's scheduled tasks or transient state.

Source: includes/Installer.php:50

PHP
add_action( 'cafetito_deactivated', function () {
    wp_clear_scheduled_hook( 'my_addon_cron' );
} );
cafetito_uninstalledAction

Fires from the uninstall routine after Cafetito has removed its own data. Use it to delete any options, tables, or files your extension created so the uninstall is complete.

Source: uninstall.php:50

PHP
add_action( 'cafetito_uninstalled', function () {
    delete_option( 'my_addon_settings' );
} );
cafetito_admin_loadedAction

Fires when the Cafetito admin layer has finished initializing (menus, list tables, and admin services). Use it to hook additional admin-only behavior that depends on Cafetito's admin objects being available.

Parameters
NameTypeDescription
$admin`Cafetito\Admin\Admin`The admin controller instance.

Source: includes/Admin/Admin.php:40

PHP
add_action( 'cafetito_admin_loaded', function ( $admin ) {
    // Register extra admin behavior here.
}, 10, 1 );

Settings & capabilities 8

cafetito_capabilitiesFilter

Filters the list of WordPress roles that receive the Cafetito management capability when the plugin is installed. By default only administrator is granted. Add role slugs to extend access.

Parameters
NameTypeDescription
$roles`string[]`*Value to return.* Array of role slugs that should receive the capability.

Source: includes/Installer.php:146

PHP
add_filter( 'cafetito_capabilities', function ( $roles ) {
    $roles[] = 'shop_manager';
    return $roles;
} );
cafetito_admin_menu_capabilityFilter

Filters the capability required to see and access the Cafetito admin menu. Use it to relax or tighten who can reach the plugin's screens.

Parameters
NameTypeDescription
$capability`string`*Value to return.* The capability slug required for the menu (default is Cafetito's management capability).

Source: includes/Admin/Menu.php:65

PHP
add_filter( 'cafetito_admin_menu_capability', function ( $capability ) {
    return 'manage_options';
} );
cafetito_settings_tabsFilter

Filters the tabs shown on the settings page. Add an entry to register a new settings tab provided by your extension.

Parameters
NameTypeDescription
$tabs`array`*Value to return.* Map of tab slug to tab label.

Source: includes/Admin/Settings.php:70

PHP
add_filter( 'cafetito_settings_tabs', function ( $tabs ) {
    $tabs['my_addon'] = __( 'My Add-on', 'my-addon' );
    return $tabs;
} );
cafetito_default_settingsFilter

Filters the default settings values for a given settings group. It fires once per group (for example general and email), with the group name as the second argument. Use it to provide defaults for your own settings or override the plugin's.

Parameters
NameTypeDescription
$defaults`array`*Value to return.* Map of setting key to default value for the group.
$group`string`The settings group being defaulted (for example general or email).

Source: includes/Admin/Settings.php:97 (primary). Fired in 2 locations (Settings.php:97 and Settings.php:123).

PHP
add_filter( 'cafetito_default_settings', function ( $defaults, $group ) {
    if ( 'general' === $group ) {
        $defaults['my_option'] = 'default value';
    }
    return $defaults;
}, 10, 2 );
cafetito_settings_savedAction

Fires after a settings tab has been saved. Use it to react to configuration changes, for example to flush caches or recompute derived options.

Parameters
NameTypeDescription
$tab`string`The slug of the settings tab that was saved.

Source: includes/Admin/Settings.php:230

PHP
add_action( 'cafetito_settings_saved', function ( $tab ) {
    if ( 'general' === $tab ) {
        // React to saved general settings.
    }
} );
cafetito_settings_render_tabAction

Fires while rendering the settings page so a custom tab can output its own fields. The current tab slug is passed so you can render only when your tab is active.

Parameters
NameTypeDescription
$current`string`The slug of the tab currently being rendered.
$settings`Cafetito\Admin\Settings`The settings service instance, for reading current values.

Source: includes/Admin/SettingsPage.php:106

PHP
add_action( 'cafetito_settings_render_tab', function ( $current, $settings ) {
    if ( 'my_addon' === $current ) {
        echo '<p>My add-on settings go here.</p>';
    }
}, 10, 2 );
cafetito_settings_gateway_itemsAction

Fires within the gateways section of the settings page so add-on gateways can render their configuration controls alongside the built-in ones.

Parameters
NameTypeDescription
$settings`Cafetito\Admin\Settings`The settings service instance.

Source: includes/Admin/SettingsPage.php:203

PHP
add_action( 'cafetito_settings_gateway_items', function ( $settings ) {
    // Output configuration UI for a custom gateway.
}, 10, 1 );
cafetito_settings_groupsAction

Fires while rendering a settings tab to allow adding extra setting groups (sections) to that tab. The tab slug is passed so output can be conditional.

Parameters
NameTypeDescription
$tab`string`The slug of the tab being rendered.
$settings`Cafetito\Admin\Settings`The settings service instance.

Source: includes/Admin/SettingsPage.php:708

PHP
add_action( 'cafetito_settings_groups', function ( $tab, $settings ) {
    if ( 'general' === $tab ) {
        // Render an extra settings group.
    }
}, 10, 2 );

Gateways & payment methods 6

cafetito_gatewaysFilter

Filters the array of registered payment gateways. This is the primary extension point to add a custom gateway to Cafetito: append your gateway instance to the array.

Parameters
NameTypeDescription
$gateways`array`*Value to return.* Array of gateway instances keyed by gateway id.

Source: includes/Gateways/GatewayRegistry.php:132

PHP
add_filter( 'cafetito_gateways', function ( $gateways ) {
    $gateways['my_gateway'] = new My_Gateway();
    return $gateways;
} );
cafetito_gateway_registeredAction

Fires each time a gateway is registered in the registry. Use it to react when a particular gateway becomes available, for example to attach gateway-specific hooks.

Parameters
NameTypeDescription
$gateway`Cafetito\Gateways\GatewayInterface`The gateway instance that was registered.

Source: includes/Gateways/GatewayRegistry.php:107

PHP
add_action( 'cafetito_gateway_registered', function ( $gateway ) {
    error_log( 'Gateway registered: ' . $gateway->get_id() );
}, 10, 1 );
cafetito_default_gatewayFilter

Filters the id of the gateway used by default when none is explicitly selected. By default it is the first available gateway. Return a different gateway id to change the default.

Parameters
NameTypeDescription
$gateway_id`string`*Value to return.* The default gateway id.

Source: includes/Gateways/GatewayRegistry.php:88

PHP
add_filter( 'cafetito_default_gateway', function ( $gateway_id ) {
    return 'redsys';
} );
cafetito_redsys_endpointFilter

Filters the Redsys endpoint URL resolved for a given operation type and environment. Use it to point requests at a custom or alternative endpoint.

Parameters
NameTypeDescription
$url`string`*Value to return.* The resolved endpoint URL.
$type`string`The endpoint type being resolved (for example the redirect or REST endpoint).
$test`bool`Whether the test (sandbox) environment is in use.

Source: includes/Gateways/Redsys/RedsysEndpoints.php:73

PHP
add_filter( 'cafetito_redsys_endpoint', function ( $url, $type, $test ) {
    return $url;
}, 10, 3 );
cafetito_redsys_request_paramsFilter

Filters the parameters sent to Redsys when starting or processing a payment. Use it to add or adjust merchant parameters before the request is signed and sent. The third argument is the payment context, which is null for some flows (such as refunds).

Parameters
NameTypeDescription
$params`array`*Value to return.* The Redsys request parameters.
$transaction`Cafetito\Payments\Transaction`The transaction being processed.
$context`Cafetito\Payments\PaymentContext|null`The payment context, or null when not applicable.

Source: includes/Gateways/Redsys/RedsysGateway.php:222 (primary). Fired in 2 locations (RedsysGateway.php:222 and RedsysGateway.php:298).

PHP
add_filter( 'cafetito_redsys_request_params', function ( $params, $transaction, $context ) {
    $params['DS_MERCHANT_MERCHANTDATA'] = 'custom';
    return $params;
}, 10, 3 );
cafetito_redsys_error_messagesFilter

Filters the map of Redsys error codes to human-readable messages used when surfacing refund and operation errors. Add or override codes to customize the wording shown to administrators.

Parameters
NameTypeDescription
$messages`array`*Value to return.* Map of Redsys error code (for example SIS0057) to its message string.

Source: includes/Admin/RefundController.php:330

PHP
add_filter( 'cafetito_redsys_error_messages', function ( $messages ) {
    $messages['SIS0058'] = __( 'Response data is not valid.', 'my-addon' );
    return $messages;
} );

Payment & transaction lifecycle 10

cafetito_transaction_createdAction

Fires immediately after a new transaction is created and persisted, before the visitor is redirected to the gateway. Use it to record or enrich the transaction with your own metadata.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The newly created transaction.

Source: includes/Payments/PaymentProcessor.php:186

PHP
add_action( 'cafetito_transaction_created', function ( $transaction ) {
    // Persist extra data linked to this transaction.
}, 10, 1 );
cafetito_transaction_status_changedAction

Fires whenever a transaction transitions from one status to another. This is the central place to react to any state change, receiving both the old and the new status so you can branch on the specific transition.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction whose status changed.
$old_status`string`The previous status.
$new_status`string`The new status.

Source: includes/Payments/PaymentProcessor.php:132

PHP
add_action( 'cafetito_transaction_status_changed', function ( $transaction, $old_status, $new_status ) {
    error_log( sprintf( 'Transaction %s: %s -> %s', $transaction->get_id(), $old_status, $new_status ) );
}, 10, 3 );
cafetito_payment_completedAction

Fires when a payment is successfully completed. Use it to trigger fulfillment, sync to a CRM, or run any post-payment logic.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The completed transaction.

Source: includes/Payments/PaymentProcessor.php:140

PHP
add_action( 'cafetito_payment_completed', function ( $transaction ) {
    // Grant access, send to CRM, etc.
}, 10, 1 );
cafetito_payment_failedAction

Fires when a payment fails. Use it to alert staff or record the failure for follow-up.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The failed transaction.

Source: includes/Payments/PaymentProcessor.php:147

PHP
add_action( 'cafetito_payment_failed', function ( $transaction ) {
    // Notify or log the failure.
}, 10, 1 );
cafetito_payment_cancelledAction

Fires when a payment is cancelled (for example, the visitor aborts at the gateway). Use it to clean up or record the cancellation.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The cancelled transaction.

Source: includes/Payments/PaymentProcessor.php:154

PHP
add_action( 'cafetito_payment_cancelled', function ( $transaction ) {
    // Handle cancellation.
}, 10, 1 );
cafetito_before_redirectAction

Fires just before the visitor is redirected to the gateway to complete payment. Use it for last-minute logging or to set session data tied to the payment context.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction being started.
$context`Cafetito\Payments\PaymentContext`The payment context for this redirect.

Source: includes/Payments/PaymentProcessor.php:215

PHP
add_action( 'cafetito_before_redirect', function ( $transaction, $context ) {
    // Pre-redirect bookkeeping.
}, 10, 2 );
cafetito_transactions_queryFilter

Filters the query arguments used to fetch transactions from the repository. Use it to constrain or extend transaction queries globally.

Parameters
NameTypeDescription
$args`array`*Value to return.* The query arguments.

Source: includes/Payments/TransactionRepository.php:274

PHP
add_filter( 'cafetito_transactions_query', function ( $args ) {
    $args['number'] = 50;
    return $args;
} );
cafetito_order_refFilter

Filters the order reference generated for a transaction from its internal id. Use it to customize the format of the reference passed to the gateway.

Parameters
NameTypeDescription
$order_ref`string`*Value to return.* The generated order reference.
$id`int`The internal transaction id used to build the reference.

Source: includes/Payments/PaymentProcessor.php:331

PHP
add_filter( 'cafetito_order_ref', function ( $order_ref, $id ) {
    return $order_ref;
}, 10, 2 );
cafetito_event_loggedAction

Fires after Cafetito writes an entry to a transaction's event log. Use it to mirror events into an external logging or monitoring system.

Parameters
NameTypeDescription
$transaction_id`int`The id of the transaction the event belongs to.
$event`string`The event type or code.
$message`string`The log message.

Source: includes/Support/Logger.php:68

PHP
add_action( 'cafetito_event_logged', function ( $transaction_id, $event, $message ) {
    // Forward to external logging.
}, 10, 3 );
cafetito_transaction_log_contextFilter

Filters the contextual data array attached to a transaction log entry before it is stored. Use it to add structured context to your logged events.

Parameters
NameTypeDescription
$context`array`*Value to return.* The log context data.
$event`string`The event type the context belongs to.
$transaction_id`int`The id of the related transaction.

Source: includes/Support/Logger.php:46

PHP
add_filter( 'cafetito_transaction_log_context', function ( $context, $event, $transaction_id ) {
    $context['source'] = 'my-addon';
    return $context;
}, 10, 3 );

Refunds 5

cafetito_can_refundFilter

Filters whether a given transaction is allowed to be refunded. Cafetito computes an initial value from the gateway's refund support and the transaction state; return false to block, or true to allow, based on your own rules.

Parameters
NameTypeDescription
$can_refund`bool`*Value to return.* Whether the refund is permitted.
$transaction`Cafetito\Payments\Transaction`The transaction in question.

Source: includes/Payments/PaymentProcessor.php:246

PHP
add_filter( 'cafetito_can_refund', function ( $can_refund, $transaction ) {
    if ( $transaction->get_amount()->amount() > 100000 ) {
        return false;
    }
    return $can_refund;
}, 10, 2 );
cafetito_refund_amountFilter

Filters the amount to be refunded for a transaction before the refund is issued. Use it to cap or adjust the refund amount.

Parameters
NameTypeDescription
$amount`Cafetito\Payments\Money`*Value to return.* The amount to refund.
$transaction`Cafetito\Payments\Transaction`The transaction being refunded.

Source: includes/Payments/PaymentProcessor.php:258

PHP
add_filter( 'cafetito_refund_amount', function ( $amount, $transaction ) {
    return $amount;
}, 10, 2 );
cafetito_before_refundAction

Fires just before a refund request is sent to the gateway. Use it for pre-refund logging or validation side effects.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction being refunded.
$amount`Cafetito\Payments\Money`The amount about to be refunded.

Source: includes/Payments/PaymentProcessor.php:274

PHP
add_action( 'cafetito_before_refund', function ( $transaction, $amount ) {
    // Pre-refund logic.
}, 10, 2 );
cafetito_refund_completedAction

Fires after a refund has been successfully processed by the gateway. Use it to notify the donor, adjust accounting, or sync the refund elsewhere.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The refunded transaction.
$amount`Cafetito\Payments\Money`The amount that was refunded.
$result`Cafetito\Payments\RefundResult`The result object returned by the gateway.

Source: includes/Payments/PaymentProcessor.php:311

PHP
add_action( 'cafetito_refund_completed', function ( $transaction, $amount, $result ) {
    // Post-refund handling.
}, 10, 3 );
cafetito_refund_failedAction

Fires when a refund attempt fails at the gateway. Use it to alert staff or record the failure with the gateway result for diagnosis.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction whose refund failed.
$amount`Cafetito\Payments\Money`The amount that was attempted.
$result`Cafetito\Payments\RefundResult`The result object returned by the gateway, carrying the failure details.

Source: includes/Payments/PaymentProcessor.php:289

PHP
add_action( 'cafetito_refund_failed', function ( $transaction, $amount, $result ) {
    // Handle the failed refund.
}, 10, 3 );

Notifications (IPN) & returns 12

cafetito_notification_receivedAction

Fires when a gateway notification (IPN) is received and its result has been parsed. Use it to react to server-to-server payment notifications, for example to trigger custom fulfillment.

Parameters
NameTypeDescription
$result`mixed`The parsed notification result object produced by the gateway.
$gateway_id`string`The id of the gateway that sent the notification.

Source: includes/Rest/NotificationController.php:86

PHP
add_action( 'cafetito_notification_received', function ( $result, $gateway_id ) {
    // Handle the incoming notification.
}, 10, 2 );
cafetito_notification_invalid_signatureAction

Fires when an incoming gateway notification fails signature verification. Use it for security monitoring and alerting on potentially fraudulent or malformed callbacks.

Parameters
NameTypeDescription
$gateway_id`string`The id of the gateway the notification claimed to come from.
$context`array`Context about the invalid request (such as request data for diagnosis).

Source: includes/Rest/NotificationController.php:95

PHP
add_action( 'cafetito_notification_invalid_signature', function ( $gateway_id, $context ) {
    error_log( 'Invalid notification signature for ' . $gateway_id );
}, 10, 2 );
cafetito_notification_urlFilter

Filters the notification (IPN) URL that Cafetito sends to the gateway as the callback endpoint for a given gateway. Use it to override the URL, for example behind a proxy or custom routing.

Parameters
NameTypeDescription
$url`string`*Value to return.* The notification URL.
$gateway_id`string`The gateway the URL is built for.

Source: includes/Frontend/CheckoutHandler.php:587

PHP
add_filter( 'cafetito_notification_url', function ( $url, $gateway_id ) {
    return $url;
}, 10, 2 );
cafetito_payment_return_successAction

Fires on the return screen when the visitor comes back from a successful payment. Use it to display a thank-you, fire analytics, or run front-end side effects on the success page.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction associated with the return.

Source: includes/Frontend/ReturnScreen.php:80

PHP
add_action( 'cafetito_payment_return_success', function ( $transaction ) {
    // Fire a conversion event, etc.
}, 10, 1 );
cafetito_payment_return_cancelAction

Fires on the return screen when the visitor returns after cancelling the payment. Use it to record the cancellation or show a custom message.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction associated with the return.

Source: includes/Frontend/ReturnScreen.php:87

PHP
add_action( 'cafetito_payment_return_cancel', function ( $transaction ) {
    // Handle the cancellation return.
}, 10, 1 );
cafetito_result_htmlFilter

Filters the full HTML of the return result card before it is output to the page. Use it to wrap, replace, or augment the rendered result.

Parameters
NameTypeDescription
$card`string`*Value to return.* The HTML of the result card.
$transaction`Cafetito\Payments\Transaction|null`The transaction, or null if not resolvable.
$variant`string`The result variant: success, cancelled, or rejected.

Source: includes/Frontend/ReturnScreen.php:101

PHP
add_filter( 'cafetito_result_html', function ( $card, $transaction, $variant ) {
    return $card . '<p>Thank you.</p>';
}, 10, 3 );
cafetito_result_titleFilter

Filters the title shown on the return result screen for a given variant. Use it to customize the heading wording.

Parameters
NameTypeDescription
$title`string`*Value to return.* The result title.
$variant`string`The result variant: success, cancelled, or rejected.

Source: includes/Frontend/ReturnScreen.php:262

PHP
add_filter( 'cafetito_result_title', function ( $title, $variant ) {
    if ( 'success' === $variant ) {
        return __( 'Payment received', 'my-addon' );
    }
    return $title;
}, 10, 2 );
cafetito_result_summaryFilter

Filters the summary rows (label/value pairs) shown for the transaction on the return screen. Use it to add or remove rows of detail.

Parameters
NameTypeDescription
$rows`array`*Value to return.* The summary rows.
$transaction`Cafetito\Payments\Transaction`The transaction being summarized.

Source: includes/Frontend/ReturnScreen.php:307

PHP
add_filter( 'cafetito_result_summary', function ( $rows, $transaction ) {
    $rows['reference'] = $transaction->get_order_ref();
    return $rows;
}, 10, 2 );
cafetito_result_actionsFilter

Filters the action buttons or links shown on the return screen for a given variant. Use it to add a "return to home" or custom call-to-action button.

Parameters
NameTypeDescription
$actions`array`*Value to return.* The result actions.
$variant`string`The result variant: success, cancelled, or rejected.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Frontend/ReturnScreen.php:371

PHP
add_filter( 'cafetito_result_actions', function ( $actions, $variant, $transaction ) {
    return $actions;
}, 10, 3 );
cafetito_success_messageFilter

Filters the body message shown on a successful return. The second argument indicates whether the result is definitive (confirmed) or still provisional.

Parameters
NameTypeDescription
$body`string`*Value to return.* The success message body.
$definitive`bool`Whether the success is confirmed/definitive.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Frontend/ReturnScreen.php:231

PHP
add_filter( 'cafetito_success_message', function ( $body, $definitive, $transaction ) {
    return $body;
}, 10, 3 );
cafetito_cancel_messageFilter

Filters the body message shown when the visitor returns after cancelling. Use it to customize the cancellation copy.

Parameters
NameTypeDescription
$body`string`*Value to return.* The cancel message body.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Frontend/ReturnScreen.php:242

PHP
add_filter( 'cafetito_cancel_message', function ( $body, $transaction ) {
    return $body;
}, 10, 2 );
cafetito_rejected_messageFilter

Filters the body message shown when a payment is rejected. Use it to customize the rejection copy.

Parameters
NameTypeDescription
$body`string`*Value to return.* The rejected message body.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Frontend/ReturnScreen.php:253

PHP
add_filter( 'cafetito_rejected_message', function ( $body, $transaction ) {
    return $body;
}, 10, 2 );

Forms & shortcode 29

cafetito_shortcode_attsFilter

Filters the parsed attributes of the Cafetito shortcode before they are used to build the button configuration. Use it to inject defaults or override attributes globally.

Parameters
NameTypeDescription
$atts`array`*Value to return.* The shortcode attributes.

Source: includes/Frontend/Shortcode.php:59

PHP
add_filter( 'cafetito_shortcode_atts', function ( $atts ) {
    $atts['currency'] = 'EUR';
    return $atts;
} );
cafetito_block_attributesFilter

Filters the attributes of the Cafetito Gutenberg block before rendering. Use it to normalize or extend block attributes.

Parameters
NameTypeDescription
$attributes`array`*Value to return.* The block attributes.

Source: includes/Frontend/Block.php:81

PHP
add_filter( 'cafetito_block_attributes', function ( $attributes ) {
    return $attributes;
} );
cafetito_button_configFilter

Filters the resolved button configuration object built from the shortcode or block attributes. This is the central object describing a payment button or form. Use it to programmatically adjust amounts, fields, labels, or gateway selection.

Parameters
NameTypeDescription
$config`Cafetito\Frontend\ButtonConfig`*Value to return.* The button configuration.
$atts`array`The source attributes the config was built from.

Source: includes/Frontend/ButtonConfig.php:157

PHP
add_filter( 'cafetito_button_config', function ( $config, $atts ) {
    return $config;
}, 10, 2 );
cafetito_form_fieldsFilter

Filters the list of available donor form fields. Use it to register a custom field or remove a built-in one.

Parameters
NameTypeDescription
$fields`array`*Value to return.* The available form fields definition.

Source: includes/Frontend/ButtonConfig.php:616

PHP
add_filter( 'cafetito_form_fields', function ( $fields ) {
    return $fields;
} );
cafetito_form_submittedAction

Fires after a front-end form has been submitted and successfully validated, just before checkout starts. Use it to react to a valid submission, for example to capture the sanitized visitor input.

Parameters
NameTypeDescription
$config`Cafetito\Frontend\ButtonConfig`The button configuration of the submitted form.
$input`array`The sanitized visitor input.

Source: includes/Frontend/CheckoutHandler.php:101

PHP
add_action( 'cafetito_form_submitted', function ( $config, $input ) {
    // React to a valid submission.
}, 10, 2 );
cafetito_validation_failedAction

Fires when server-side validation of a form submission fails, before the visitor is redirected back with errors. Use it to log or monitor failed submissions.

Parameters
NameTypeDescription
$config`Cafetito\Frontend\ButtonConfig`The button configuration of the submitted form.
$errors`array`Map of field key to error message.

Source: includes/Frontend/CheckoutHandler.php:90

PHP
add_action( 'cafetito_validation_failed', function ( $config, $errors ) {
    // Log validation failures.
}, 10, 2 );
cafetito_validation_errorsFilter

Filters the validation errors of a form submission. It lets an add-on add or remove errors (for example, to enforce a custom required field). The errors map uses field keys to message strings.

Parameters
NameTypeDescription
$errors`array`*Value to return.* Map of field key to error message.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.
$input`array`The sanitized visitor input.

Source: includes/Frontend/CheckoutHandler.php:153

PHP
add_filter( 'cafetito_validation_errors', function ( $errors, $config, $input ) {
    if ( empty( $input['cf_donor_phone'] ) ) {
        $errors['cf_donor_phone'] = __( 'Phone is required.', 'my-addon' );
    }
    return $errors;
}, 10, 3 );
cafetito_transaction_dataFilter

Filters the data array used to create a transaction from a validated submission. Use it to attach additional fields, metadata, or computed values to the transaction at creation time.

Parameters
NameTypeDescription
$data`array`*Value to return.* The transaction data.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.
$input`array`The sanitized visitor input.

Source: includes/Frontend/CheckoutHandler.php:351

PHP
add_filter( 'cafetito_transaction_data', function ( $data, $config, $input ) {
    $data['meta']['campaign'] = 'spring';
    return $data;
}, 10, 3 );
cafetito_return_url_successFilter

Filters the URL the gateway should redirect to after a successful payment. Use it to send the visitor to a custom thank-you page instead of the default return screen.

Parameters
NameTypeDescription
$url`string`*Value to return.* The success return URL.
$order_ref`string`The order reference of the transaction.

Source: includes/Frontend/CheckoutHandler.php:533

PHP
add_filter( 'cafetito_return_url_success', function ( $url, $order_ref ) {
    return home_url( '/thank-you/' );
}, 10, 2 );
cafetito_return_url_cancelFilter

Filters the URL the gateway should redirect to after a cancelled payment. Use it to send the visitor to a custom page.

Parameters
NameTypeDescription
$url`string`*Value to return.* The cancel return URL.
$order_ref`string`The order reference of the transaction.

Source: includes/Frontend/CheckoutHandler.php:542

PHP
add_filter( 'cafetito_return_url_cancel', function ( $url, $order_ref ) {
    return home_url( '/cancelled/' );
}, 10, 2 );
cafetito_client_ipFilter

Filters the client IP address resolved for the current request, used for logging and fraud checks. Use it when behind a proxy or load balancer to provide the correct originating IP.

Parameters
NameTypeDescription
$ip`string|null`*Value to return.* The resolved client IP, or null if none was determined.

Source: includes/Frontend/CheckoutHandler.php:639

PHP
add_filter( 'cafetito_client_ip', function ( $ip ) {
    if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
        return explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] )[0];
    }
    return $ip;
} );
cafetito_currencyFilter

Filters the currency code used by the plugin. Defaults to EUR. Return a different ISO currency code to change the currency used for amounts and formatting.

Parameters
NameTypeDescription
$currency`string`*Value to return.* The currency code (default EUR).

Source: includes/Frontend/ButtonConfig.php:492 (primary). Fired in 2 locations (ButtonConfig.php:492 and Admin/TransactionsListPage.php:166).

PHP
add_filter( 'cafetito_currency', function ( $currency ) {
    return 'USD';
} );
cafetito_default_conceptFilter

Filters the default concept (description) text used for a payment when none is supplied, for a given button type. Use it to provide a custom default concept.

Parameters
NameTypeDescription
$concept`string`*Value to return.* The default concept text.
$type`string`The button type the concept applies to.

Source: includes/Frontend/ButtonConfig.php:515

PHP
add_filter( 'cafetito_default_concept', function ( $concept, $type ) {
    return __( 'Support our work', 'my-addon' );
}, 10, 2 );
cafetito_format_moneyFilter

Filters the formatted, human-readable string of a monetary amount. Use it to fully customize how amounts are displayed (separators, symbol placement, decimals).

Parameters
NameTypeDescription
$result`string`*Value to return.* The formatted money string.
$money`Cafetito\Payments\Money`The money object being formatted.
$force_decimals`bool`Whether decimals are forced in the output.

Source: includes/Frontend/Format.php:60

PHP
add_filter( 'cafetito_format_money', function ( $result, $money, $force_decimals ) {
    return $result;
}, 10, 3 );
cafetito_before_formAction

Fires immediately before the payment form is rendered. Use it to output content above the form, given the resolved configuration.

Parameters
NameTypeDescription
$config`Cafetito\Frontend\ButtonConfig`The button configuration being rendered.

Source: includes/Frontend/FormRenderer.php:138

PHP
add_action( 'cafetito_before_form', function ( $config ) {
    echo '<p>Your contribution matters.</p>';
}, 10, 1 );
cafetito_after_formAction

Fires immediately after the payment form is rendered. Use it to output content below the form.

Parameters
NameTypeDescription
$config`Cafetito\Frontend\ButtonConfig`The button configuration being rendered.

Source: includes/Frontend/FormRenderer.php:147

PHP
add_action( 'cafetito_after_form', function ( $config ) {
    echo '<small>Secure payment.</small>';
}, 10, 1 );
cafetito_form_htmlFilter

Filters the complete rendered HTML of the payment form. Use it to wrap or post-process the markup.

Parameters
NameTypeDescription
$html`string`*Value to return.* The form HTML.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.
$context`mixed`The rendering context.

Source: includes/Frontend/FormRenderer.php:159

PHP
add_filter( 'cafetito_form_html', function ( $html, $config, $context ) {
    return $html;
}, 10, 3 );
cafetito_form_titleFilter

Filters the title of the payment form. Use it to override the heading text.

Parameters
NameTypeDescription
$title`string`*Value to return.* The form title.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.

Source: includes/Frontend/FormRenderer.php:253

PHP
add_filter( 'cafetito_form_title', function ( $title, $config ) {
    return __( 'Make a donation', 'my-addon' );
}, 10, 2 );
cafetito_form_subtitleFilter

Filters the subtitle of the payment form. Use it to override the secondary heading text.

Parameters
NameTypeDescription
$subtitle`string`*Value to return.* The form subtitle.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.

Source: includes/Frontend/FormRenderer.php:265

PHP
add_filter( 'cafetito_form_subtitle', function ( $subtitle, $config ) {
    return $subtitle;
}, 10, 2 );
cafetito_field_labelFilter

Filters the label of a donor form field. Use it to rename fields shown to visitors.

Parameters
NameTypeDescription
$label`string`*Value to return.* The field label.
$field`string`The field key.

Source: includes/Frontend/FormRenderer.php:663

PHP
add_filter( 'cafetito_field_label', function ( $label, $field ) {
    if ( 'name' === $field ) {
        return __( 'Full name', 'my-addon' );
    }
    return $label;
}, 10, 2 );
cafetito_method_labelFilter

Filters the label of a payment method shown in the form. Use it to rename a method (for example, "Card" or "Bizum").

Parameters
NameTypeDescription
$label`string`*Value to return.* The method label.
$method`string`The method key.

Source: includes/Frontend/FormRenderer.php:748

PHP
add_filter( 'cafetito_method_label', function ( $label, $method ) {
    return $label;
}, 10, 2 );
cafetito_method_iconFilter

Filters the icon used for a payment method in the form. Use it to supply a custom icon URL or markup.

Parameters
NameTypeDescription
$icon`string`*Value to return.* The method icon.
$method`string`The method key.

Source: includes/Frontend/FormRenderer.php:771

PHP
add_filter( 'cafetito_method_icon', function ( $icon, $method ) {
    return $icon;
}, 10, 2 );
cafetito_method_sublabelFilter

Filters the secondary label (sublabel) of a payment method shown in the form. Use it to add a short descriptor under the method name.

Parameters
NameTypeDescription
$sub`string`*Value to return.* The method sublabel.
$method`string`The method key.

Source: includes/Frontend/FormRenderer.php:794

PHP
add_filter( 'cafetito_method_sublabel', function ( $sub, $method ) {
    return $sub;
}, 10, 2 );
cafetito_submit_labelFilter

Filters the submit button label of the payment form. Use it to customize the call-to-action wording.

Parameters
NameTypeDescription
$label`string`*Value to return.* The submit button label.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.

Source: includes/Frontend/FormRenderer.php:889

PHP
add_filter( 'cafetito_submit_label', function ( $label, $config ) {
    return __( 'Donate now', 'my-addon' );
}, 10, 2 );
cafetito_compact_labelFilter

Filters the label used in the compact (inline button) rendering mode of the form. Use it to customize the wording in compact layouts.

Parameters
NameTypeDescription
$label`string`*Value to return.* The compact button label.
$config`Cafetito\Frontend\ButtonConfig`The button configuration.

Source: includes/Frontend/FormRenderer.php:927

PHP
add_filter( 'cafetito_compact_label', function ( $label, $config ) {
    return $label;
}, 10, 2 );
cafetito_presetFilter

Filters the front-end form preset (style/layout preset) before it is applied. Use it to override the visual preset of forms.

Parameters
NameTypeDescription
$preset`mixed`*Value to return.* The form preset.

Source: includes/Frontend/FormRenderer.php:945

PHP
add_filter( 'cafetito_preset', function ( $preset ) {
    return $preset;
} );
cafetito_assets_registeredAction

Fires after the front-end assets (scripts and styles) have been registered with WordPress. Use it to register additional assets or declare dependencies on Cafetito's handles.

Parameters
NameTypeDescription
$assets`Cafetito\Frontend\Assets`The assets manager instance.

Source: includes/Frontend/Assets.php:86

PHP
add_action( 'cafetito_assets_registered', function ( $assets ) {
    wp_register_style( 'my-addon-css', plugins_url( 'addon.css', __FILE__ ) );
}, 10, 1 );
cafetito_assets_enqueuedAction

Fires after the front-end assets have been enqueued for output. Use it to enqueue your own assets that depend on Cafetito's.

Source: includes/Frontend/Assets.php:109

PHP
add_action( 'cafetito_assets_enqueued', function () {
    wp_enqueue_style( 'my-addon-css' );
} );
cafetito_icon_urlFilter

Filters the URL of a named built-in icon. The default points to the SVG bundled with the plugin. Use it to swap an icon for your own asset.

Parameters
NameTypeDescription
$url`string`*Value to return.* The icon URL.
$name`string`The icon name being resolved.

Source: includes/Frontend/Assets.php:127

PHP
add_filter( 'cafetito_icon_url', function ( $url, $name ) {
    if ( 'visa' === $name ) {
        return plugins_url( 'icons/visa.svg', __FILE__ );
    }
    return $url;
}, 10, 2 );

Emails 13

cafetito_before_send_emailAction

Fires just before a notification email is sent. Use it for last-minute logging or to alter related state for a given email type and transaction.

Parameters
NameTypeDescription
$type`string`The email type (for example a status notification key).
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:176

PHP
add_action( 'cafetito_before_send_email', function ( $type, $transaction ) {
    // Pre-send logic.
}, 10, 2 );
cafetito_email_sentAction

Fires after a notification email is sent successfully. Use it to record that the email went out or to chain further notifications.

Parameters
NameTypeDescription
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:189

PHP
add_action( 'cafetito_email_sent', function ( $type, $transaction ) {
    // Log delivery.
}, 10, 2 );
cafetito_email_failedAction

Fires when sending a notification email fails. Use it to alert staff or retry through an alternative channel.

Parameters
NameTypeDescription
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:199

PHP
add_action( 'cafetito_email_failed', function ( $type, $transaction ) {
    // Handle the delivery failure.
}, 10, 2 );
cafetito_email_enabledFilter

Filters whether a given email type should be sent for a transaction. Defaults to true. Return false to suppress a specific notification.

Parameters
NameTypeDescription
$enabled`bool`*Value to return.* Whether the email is enabled (default true).
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:221

PHP
add_filter( 'cafetito_email_enabled', function ( $enabled, $type, $transaction ) {
    if ( 'admin_notice' === $type ) {
        return false;
    }
    return $enabled;
}, 10, 3 );
cafetito_email_placeholdersFilter

Filters the placeholder map used to interpolate the email subject and body for a transaction. Use it to add custom placeholders that your templates can reference.

Parameters
NameTypeDescription
$placeholders`array`*Value to return.* Map of placeholder token to replacement value.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:110

PHP
add_filter( 'cafetito_email_placeholders', function ( $placeholders, $transaction ) {
    $placeholders['{campaign}'] = 'Spring 2026';
    return $placeholders;
}, 10, 2 );
cafetito_email_subjectFilter

Filters the subject line of a notification email. Use it to customize the subject per email type.

Parameters
NameTypeDescription
$subject`string`*Value to return.* The email subject (default is the plugin's default subject for the type).
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:123

PHP
add_filter( 'cafetito_email_subject', function ( $subject, $type, $transaction ) {
    return $subject;
}, 10, 3 );
cafetito_email_bodyFilter

Filters the raw body message of a notification email before placeholders are applied and the HTML is built. Use it to replace the template text.

Parameters
NameTypeDescription
$body`string`*Value to return.* The email body (default is the plugin's default message for the type).
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:142

PHP
add_filter( 'cafetito_email_body', function ( $body, $type, $transaction ) {
    return $body;
}, 10, 3 );
cafetito_email_htmlFilter

Filters the final HTML of a notification email after the body has been assembled. Use it to wrap the content in a custom template or add a header/footer.

Parameters
NameTypeDescription
$body`string`*Value to return.* The email HTML.
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:166

PHP
add_filter( 'cafetito_email_html', function ( $body, $type, $transaction ) {
    return '<div class="brand">' . $body . '</div>';
}, 10, 3 );
cafetito_email_recipientsFilter

Filters the list of recipients for a notification email. Use it to add or remove recipients (for example, a BCC for accounting).

Parameters
NameTypeDescription
$recipients`array`*Value to return.* Array of recipient email addresses.
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:252

PHP
add_filter( 'cafetito_email_recipients', function ( $recipients, $type, $transaction ) {
    $recipients[] = 'accounting@example.com';
    return $recipients;
}, 10, 3 );
cafetito_email_presetFilter

Filters the email preset (style/template preset) applied to a notification email for a given type and transaction. Use it to switch presets per email type.

Parameters
NameTypeDescription
$preset`mixed`*Value to return.* The email preset.
$type`string`The email type.
$transaction`Cafetito\Payments\Transaction`The related transaction.

Source: includes/Notifications/EmailService.php:363

PHP
add_filter( 'cafetito_email_preset', function ( $preset, $type, $transaction ) {
    return $preset;
}, 10, 3 );
cafetito_email_from_nameFilter

Filters the "From" name used when sending notification emails. Defaults to the site name. Use it to brand outgoing emails.

Parameters
NameTypeDescription
$from_name`string`*Value to return.* The from name (default is the site name).
$type`string`The email type.

Source: includes/Notifications/EmailService.php:409

PHP
add_filter( 'cafetito_email_from_name', function ( $from_name, $type ) {
    return 'My Organization';
}, 10, 2 );
cafetito_email_from_addressFilter

Filters the "From" address used when sending notification emails. Defaults to empty (WordPress default). Use it to set a custom sender address.

Parameters
NameTypeDescription
$from_address`string`*Value to return.* The from email address (default empty).
$type`string`The email type.

Source: includes/Notifications/EmailService.php:417

PHP
add_filter( 'cafetito_email_from_address', function ( $from_address, $type ) {
    return 'noreply@example.com';
}, 10, 2 );
cafetito_email_headersFilter

Filters the headers array sent with a notification email. Use it to add custom headers, Reply-To, or CC/BCC headers.

Parameters
NameTypeDescription
$headers`array`*Value to return.* The email headers.
$type`string`The email type.

Source: includes/Notifications/EmailService.php:429

PHP
add_filter( 'cafetito_email_headers', function ( $headers, $type ) {
    $headers[] = 'Reply-To: support@example.com';
    return $headers;
}, 10, 2 );

Admin 15

cafetito_admin_assets_enqueuedAction

Fires after the admin assets are enqueued, with the current admin page hook suffix. Use it to enqueue your own admin assets on Cafetito's screens.

Parameters
NameTypeDescription
$hook_suffix`string`The current admin page hook suffix.

Source: includes/Admin/Assets.php:105

PHP
add_action( 'cafetito_admin_assets_enqueued', function ( $hook_suffix ) {
    wp_enqueue_script( 'my-addon-admin' );
}, 10, 1 );
cafetito_admin_status_badgesFilter

Filters the map of transaction statuses to their admin badge definitions (label and styling). Use it to add badges for custom statuses or restyle existing ones.

Parameters
NameTypeDescription
$map`array`*Value to return.* Map of status key to badge definition.

Source: includes/Admin/StatusBadge.php:62

PHP
add_filter( 'cafetito_admin_status_badges', function ( $map ) {
    return $map;
} );
cafetito_admin_summary_dataFilter

Filters the summary cards shown above the transactions list. Use it to add custom KPI cards computed from the current summary and filters.

Parameters
NameTypeDescription
$cards`array`*Value to return.* The summary cards.
$summary`array`The computed summary data.
$filters`array`The active list filters.

Source: includes/Admin/TransactionsListPage.php:221

PHP
add_filter( 'cafetito_admin_summary_data', function ( $cards, $summary, $filters ) {
    return $cards;
}, 10, 3 );
cafetito_admin_bulk_actionsFilter

Filters the bulk actions available on the transactions list table. Use it to register a custom bulk action.

Parameters
NameTypeDescription
$actions`array`*Value to return.* Map of bulk action key to label.

Source: includes/Admin/TransactionsListPage.php:275

PHP
add_filter( 'cafetito_admin_bulk_actions', function ( $actions ) {
    $actions['my_action'] = __( 'My bulk action', 'my-addon' );
    return $actions;
} );
cafetito_admin_list_columnsFilter

Filters the columns displayed in the transactions list table. Use it to add or remove columns.

Parameters
NameTypeDescription
$columns`array`*Value to return.* Map of column key to column label.

Source: includes/Admin/TransactionsListPage.php:462

PHP
add_filter( 'cafetito_admin_list_columns', function ( $columns ) {
    $columns['campaign'] = __( 'Campaign', 'my-addon' );
    return $columns;
} );
cafetito_admin_list_columnAction

Fires while rendering a cell of a custom column in the transactions list, for each row. Echo the cell content for your column when its key matches.

Parameters
NameTypeDescription
$key`string`The column key being rendered.
$transaction`Cafetito\Payments\Transaction`The transaction for the current row.

Source: includes/Admin/TransactionsListPage.php:571

PHP
add_action( 'cafetito_admin_list_column', function ( $key, $transaction ) {
    if ( 'campaign' === $key ) {
        echo esc_html( $transaction->get_meta( 'campaign' ) );
    }
}, 10, 2 );
cafetito_admin_list_rowAction

Fires once per transaction row while rendering the list table. Use it to output extra row markup or trigger per-row logic.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction for the current row.

Source: includes/Admin/TransactionsListPage.php:584

PHP
add_action( 'cafetito_admin_list_row', function ( $transaction ) {
    // Per-row admin output.
}, 10, 1 );
cafetito_admin_filtersAction

Fires while rendering the filter controls above the transactions list. Use it to output additional filter inputs. The current active filters are passed.

Parameters
NameTypeDescription
$filters`array`The active list filters.

Source: includes/Admin/TransactionsListPage.php:359

PHP
add_action( 'cafetito_admin_filters', function ( $filters ) {
    // Render an extra filter control.
}, 10, 1 );
cafetito_admin_list_query_argsFilter

Filters the query arguments used to fetch transactions for the admin list, given the active filters. Use it to apply custom filtering logic to the admin list query.

Parameters
NameTypeDescription
$args`array`*Value to return.* The query arguments.
$filters`array`The active list filters.

Source: includes/Admin/ListFilters.php:122

PHP
add_filter( 'cafetito_admin_list_query_args', function ( $args, $filters ) {
    return $args;
}, 10, 2 );
cafetito_admin_detail_after_dataAction

Fires on the transaction detail screen, after the core transaction data section. Use it to render additional panels or metadata for the transaction.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction being viewed.

Source: includes/Admin/TransactionDetailPage.php:74

PHP
add_action( 'cafetito_admin_detail_after_data', function ( $transaction ) {
    echo '<h3>' . esc_html__( 'Extra info', 'my-addon' ) . '</h3>';
}, 10, 1 );
cafetito_admin_detail_actionsFilter

Filters the action buttons shown on the transaction detail screen. Use it to add a custom action (for example, a link to an external system).

Parameters
NameTypeDescription
$actions`array`*Value to return.* The detail action buttons.
$transaction`Cafetito\Payments\Transaction`The transaction being viewed.

Source: includes/Admin/TransactionDetailPage.php:155

PHP
add_filter( 'cafetito_admin_detail_actions', function ( $actions, $transaction ) {
    return $actions;
}, 10, 2 );
cafetito_transaction_reviewedAction

Fires when an administrator marks a transaction as reviewed. Use it to record the review or trigger downstream workflow.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The reviewed transaction.

Source: includes/Admin/ListActions.php:145

PHP
add_action( 'cafetito_transaction_reviewed', function ( $transaction ) {
    // React to the review.
}, 10, 1 );
cafetito_internal_note_savedAction

Fires after an internal note is saved on a transaction. Use it to react to staff notes, for example to sync them elsewhere.

Parameters
NameTypeDescription
$transaction`Cafetito\Payments\Transaction`The transaction the note was saved on.

Source: includes/Admin/RefundController.php:149

PHP
add_action( 'cafetito_internal_note_saved', function ( $transaction ) {
    // Handle the saved note.
}, 10, 1 );
cafetito_export_csv_headersFilter

Filters the header row used for the CSV export of transactions. Use it to add columns to the export (pair with cafetito_export_csv_row).

Parameters
NameTypeDescription
$headers`array`*Value to return.* The CSV header columns.

Source: includes/Admin/ListActions.php:203

PHP
add_filter( 'cafetito_export_csv_headers', function ( $headers ) {
    $headers[] = 'Campaign';
    return $headers;
} );
cafetito_export_csv_rowFilter

Filters a single data row of the CSV export, given the transaction it represents. Use it to add values that align with custom headers.

Parameters
NameTypeDescription
$row`array`*Value to return.* The CSV row values.
$transaction`Cafetito\Payments\Transaction`The transaction for this row.

Source: includes/Admin/ListActions.php:229

PHP
add_filter( 'cafetito_export_csv_row', function ( $row, $transaction ) {
    $row[] = $transaction->get_meta( 'campaign' );
    return $row;
}, 10, 2 );

Fiscal 2

cafetito_fiscal_fieldsFilter

Filters the list of fiscal fields (such as NIF/CIF and address fields) collected for invoicing. Use it to add or remove fiscal fields.

Parameters
NameTypeDescription
$fields`array`*Value to return.* The fiscal field definitions.

Source: includes/Frontend/ButtonConfig.php:688

PHP
add_filter( 'cafetito_fiscal_fields', function ( $fields ) {
    return $fields;
} );
cafetito_fiscal_enabledFilter

Filters whether fiscal data collection is enabled. Return true or false to force fiscal fields on or off.

Parameters
NameTypeDescription
$enabled`bool`*Value to return.* Whether fiscal collection is enabled.

Source: includes/Frontend/ButtonConfig.php:707

PHP
add_filter( 'cafetito_fiscal_enabled', function ( $enabled ) {
    return true;
} );

Text & i18n 1

cafetito_textFilter

Filters a translatable text string by key, allowing centralized overriding of the plugin's user-facing copy. Match on the key to override a specific string.

Parameters
NameTypeDescription
$value`string`*Value to return.* The text value.
$key`string`The identifier of the text string.

Source: includes/Frontend/FormRenderer.php:994

PHP
add_filter( 'cafetito_text', function ( $value, $key ) {
    if ( 'thank_you' === $key ) {
        return __( 'Many thanks!', 'my-addon' );
    }
    return $value;
}, 10, 2 );

REST 1

cafetito_rest_namespaceFilter

Filters the REST API namespace used by the plugin (default cafetito/v1) for its endpoints, including the notification (IPN) route. Use it to version or relocate the plugin's REST routes. Note that changing this affects the notification URL sent to gateways, so adjust gateway configuration accordingly.

Parameters
NameTypeDescription
$namespace`string`*Value to return.* The REST namespace (default cafetito/v1).

Source: includes/Frontend/CheckoutHandler.php:578 (primary). Fired in 2 locations (CheckoutHandler.php:578 and Rest/NotificationController.php:115).

PHP
add_filter( 'cafetito_rest_namespace', function ( $namespace ) {
    return $namespace;
} );

Get the full hooks library

Every action and filter shown here ships with the Cafetito plugin.