Swish ECommerce - Hooks (Filters)

Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WooCommerce and are very useful for developers.

Read more about action and filter hooks here:
In Swish ECommerce there are some actions and filters available, mainly for modifying the order data sent to Swish and how to display extra data in Swish elements

Settings Filter

Filter:  'redlight_swish_ecommerce_settings'

Parameters:
$settings Array containing the plugin settings

Description: Fired when the plugin is loaded.

This filter can be used to create custom settings displayed in the plugins settings page.

Form Fields Filter

Filter:  'redlight_swish_ecommerce_form_fields'

Parameters:
  $default_fields Array containing the fields to be displayed in the checkout page

Description: Fired on checkout page when the option to display a form is set.

This filter can be used to create custom fields in the checkout page related to the Swish ECommerce method.

Callback Arguments Filter

Filter:  'redlight_swish_ecommerce_callback_args'

Parameters:
$args Array containing the key and values to be converted to url arguments

Description: Fired when creating the callback url that is later sent to Swish, used for Refunds and Paymentrequests

This filter can be used to create custom urls for callbacks.

Paymentrequest Message Filter

Filter:  'redlight_swish_ecommerce_paymentrequest_message'

Parameters:
$message String containing the default message
$order A WC_Order object representing the order that the payment is being made for.

Description: Fired when creating a payment request that is later sent to Swish

This filter can be used to create a custom message that is shown to the user in the Swish-app.

Paymentrequest Data Filter

Filter:  'redlight_swish_ecommerce_paymentrequest_data'

Parameters:
$data Array containing the default data that is being sent to Swish
$order A WC_Order object representing the order that the payment is being made for.

Description: Fired when creating a payment request that is later sent to Swish

This filter can be used to modify any data that is being sent as a payment request to Swish

Cancel Payment Request Data Filter

Filter:  'redlight_swish_ecommerce_cancel_paymentrequest_data'

Parameters:
$data Array containing the default data that is being sent to Swish when canceling a payment $order A WC_Order object representing the order that the payment is being made for.

Description: Fired when canceling a payment request that is later sent to Swish

This filter can be used to modify any data that is being sent when we cancel a payment request.

Refund Message Filter

Filter:  'redlight_swish_ecommerce_refund_message'

Parameters: 
$message String containing the default message
$order A WC_Order object representing the order that the refund is being made for.

Description: Fired when creating a refund that is later sent to Swish

This filter can be used to create a custom message that is shown to the user in the Swish-app.

Refund Data Filter

Filter:  'redlight_swish_ecommerce_refund_data'

Parameters:
$data Array containing the default data that is being sent to Swish
$order A WC_Order object representing the order that the payment is being made for.

Description: Fired when creating a payment request that is later sent to Swish

This filter can be used to modify any data that is being sent as a payment request to Swish