Hooks & Filters

Updated on November 27, 2025

Developers can extend and customize the PowerTranz gateway using WordPress hooks and filters. This reference documents the available extension points.

Action Hooks

woocommerce_receipt_powertranz

Fires on the order receipt page for PowerTranz payments. Used internally to display 3D Secure redirect forms when required.

add_action( 'woocommerce_receipt_powertranz', 'my_receipt_function' );

  function my_receipt_function( $order_id ) {
      // Custom receipt page content
  }

woocommerce_api_powertranz_3ds_return

Handles the callback URL when a customer returns from 3D Secure authentication. This is used internally by the plugin.

woocommerce_api_powertranz_webhook

Handles incoming webhook notifications from PowerTranz. Used internally for asynchronous payment confirmations.

woocommerce_scheduled_subscription_payment_powertranz

Fires when a subscription renewal payment is due. The plugin uses this to process automatic recurring payments.

add_action( 'woocommerce_scheduled_subscription_payment_powertranz', 'my_renewal_function', 10, 2 );

  function my_renewal_function( $renewal_total, $renewal_order ) {
      // Custom logic before/after renewal processing
  }

Filter Hooks

woocommerce_gateway_icon

Filters the payment gateway icon displayed at checkout.

add_filter( 'woocommerce_gateway_icon', 'customize_powertranz_icon', 10, 2 );

  function customize_powertranz_icon( $icon, $gateway_id ) {
      if ( 'powertranz' === $gateway_id ) {
          // Return custom icon HTML
          $icon = '<img src="your-custom-icon.png" alt="Pay with Card" />';
      }
      return $icon;
  }

woocommerce_order_actions

The plugin adds custom order actions for capturing and voiding authorized payments. You can filter these actions if needed.

add_filter( 'woocommerce_order_actions', 'modify_powertranz_actions' );

  function modify_powertranz_actions( $actions ) {
      // Modify available order actions
      return $actions;
  }

woocommerce_payment_methods_list_item

Filters the display of saved payment methods in the customer’s My Account area.

Constants

The following constants are available after the plugin loads:

ConstantDescriptionExample Value
POWERTRANZ_VERSIONCurrent plugin version‘1.0.6’
POWERTRANZ_PLUGIN_FILEAbsolute path to main plugin file/var/www/wp-content/plugins/powertranz…/powertranz-gateway.php
POWERTRANZ_PLUGIN_DIRAbsolute path to plugin directory/var/www/wp-content/plugins/powertranz…/
POWERTRANZ_PLUGIN_URLURL to plugin directoryhttps://example.com/wp-content/plugins/powertranz…/
POWERTRANZ_PLUGIN_BASENAMEPlugin basename for hookspowertranz-woocommerce-gateway/powertranz-gateway.php

Using Constants

// Check plugin version
  if ( defined( 'POWERTRANZ_VERSION' ) ) {
      echo 'PowerTranz version: ' . POWERTRANZ_VERSION;
  }

  // Include a file from the plugin directory
  include POWERTRANZ_PLUGIN_DIR . 'includes/my-custom-file.php';

  // Enqueue a script from the plugin
  wp_enqueue_script( 'my-script', POWERTRANZ_PLUGIN_URL . 'assets/js/custom.js' );

WooCommerce Payment Gateway API

The PowerTranz gateway extends the WC_Payment_Gateway class. For advanced customizations, refer to the WooCommerce Payment Gateway API documentation.

Common extension patterns:

  • Use woocommerce_payment_complete action for post-payment processing
  • Use woocommerce_order_status_changed to react to order status changes
  • Use woocommerce_available_payment_gateways to conditionally show/hide the gateway

Next