Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created March 24, 2026 09:27
Show Gist options
  • Select an option

  • Save xlplugins/329bc2c8e430a1d60b9309d3ebcc816d to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/329bc2c8e430a1d60b9309d3ebcc816d to your computer and use it in GitHub Desktop.
show crypto qr top of customer details
/** FunnelKit TY: print PayGate crypto block before Customer Details; avoid duplicate on woocommerce_before_thankyou. */
defined( 'ABSPATH' ) || exit;
/**
* @return object|null Gateway instance with before_thankyou_page, or null.
*/
function paygatedotto_wffn_ty_paygate_gw( $order ) {
if ( ! $order instanceof WC_Order ) {
return null;
}
$m = $order->get_payment_method();
if ( '' === $m || strpos( $m, 'paygatedotto-crypto-payment-gateway' ) !== 0 ) {
return null;
}
$gw = WC()->payment_gateways()->payment_gateways()[ $m ] ?? null;
return ( is_object( $gw ) && method_exists( $gw, 'before_thankyou_page' ) ) ? $gw : null;
}
add_action(
'woocommerce_before_thankyou',
static function ( $order_id ) {
if ( ! function_exists( 'WFFN_Core' ) || ! WFFN_Core()->thank_you_pages->is_wfty_page() ) {
return;
}
$gw = paygatedotto_wffn_ty_paygate_gw( wc_get_order( $order_id ) );
if ( $gw ) {
remove_action( 'woocommerce_before_thankyou', array( $gw, 'before_thankyou_page' ), 10 );
}
},
0,
1
);
add_filter(
'do_shortcode_tag',
static function ( $output, $tag ) {
if ( 'wfty_customer_details' !== $tag || ! is_string( $output )
|| ! function_exists( 'WFFN_Core' ) || ! WFFN_Core()->thank_you_pages->is_wfty_page() ) {
return $output;
}
$order = WFFN_Core()->thank_you_pages->data->get_order();
$gw = paygatedotto_wffn_ty_paygate_gw( $order );
if ( ! $gw ) {
return $output;
}
ob_start();
$gw->before_thankyou_page( $order->get_id() );
return ob_get_clean() . $output;
},
10,
4
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment