BNPLMessageController
in package
Handles BNPL messaging across all page contexts (product, cart, checkout, shop).
Queries the PaymentGatewayRegistry for gateways that support 'stripe_bnpl_msg', checks each gateway's payment_sections setting to determine if messaging is enabled for the current page, then renders DOM containers and enqueues scripts.
Tags
Table of Contents
Properties
- $context : ContextHandler
- $payment_registry : PaymentGatewayRegistry
- $supported_gateways : array<string|int, WC_Payment_Gateway_Stripe_Local_Payment>|null
- Cached array of gateways that support BNPL messaging for the current context.
Methods
- __construct() : mixed
- add_script_data() : void
- Add script data that's used by the BNPL integration to render messaging on the frontend.
- add_shop_script_data() : mixed
- enqueue_scripts() : mixed
- get_payment_gateway_icon() : string
- get_supported_countries() : mixed
- get_supported_currencies() : mixed
- get_supported_gateways() : array<string|int, WC_Payment_Gateway_Stripe_Local_Payment>
- Returns gateways that support BNPL messaging and have it enabled for the current page context.
- initialize() : mixed
- render_cart_below_checkout_button() : mixed
- render_cart_below_total() : mixed
- render_checkout_below_total() : mixed
- render_product_above_price() : mixed
- render_product_below_add_to_cart() : mixed
- render_product_below_price() : mixed
- render_shop_after_button() : mixed
- render_shop_below_price() : mixed
- get_location() : string
- Returns a BNPL location setting from Advanced Settings.
- render_cart_location() : mixed
- render_product_location() : mixed
- render_shop_location() : mixed
Properties
$context
private
ContextHandler
$context
$payment_registry
private
PaymentGatewayRegistry
$payment_registry
$supported_gateways
Cached array of gateways that support BNPL messaging for the current context.
private
array<string|int, WC_Payment_Gateway_Stripe_Local_Payment>|null
$supported_gateways
Methods
__construct()
public
__construct(PaymentGatewayRegistry $registry, ContextHandler $context) : mixed
Parameters
- $registry : PaymentGatewayRegistry
- $context : ContextHandler
add_script_data()
Add script data that's used by the BNPL integration to render messaging on the frontend.
public
add_script_data(AssetDataApi $asset_data) : void
A single Stripe element renders all supported BNPL payment method types together.
Parameters
- $asset_data : AssetDataApi
add_shop_script_data()
public
add_shop_script_data() : mixed
enqueue_scripts()
public
enqueue_scripts() : mixed
get_payment_gateway_icon()
public
get_payment_gateway_icon(string $icon, mixed $gateway_id) : string
Parameters
- $icon : string
- $gateway_id : mixed
Return values
stringget_supported_countries()
public
get_supported_countries() : mixed
get_supported_currencies()
public
get_supported_currencies() : mixed
get_supported_gateways()
Returns gateways that support BNPL messaging and have it enabled for the current page context.
public
get_supported_gateways() : array<string|int, WC_Payment_Gateway_Stripe_Local_Payment>
Return values
array<string|int, WC_Payment_Gateway_Stripe_Local_Payment>initialize()
public
initialize() : mixed
render_cart_below_checkout_button()
public
render_cart_below_checkout_button() : mixed
render_cart_below_total()
public
render_cart_below_total() : mixed
render_checkout_below_total()
public
render_checkout_below_total() : mixed
render_product_above_price()
public
render_product_above_price() : mixed
render_product_below_add_to_cart()
public
render_product_below_add_to_cart() : mixed
render_product_below_price()
public
render_product_below_price() : mixed
render_shop_after_button()
public
render_shop_after_button() : mixed
render_shop_below_price()
public
render_shop_below_price() : mixed
get_location()
Returns a BNPL location setting from Advanced Settings.
private
get_location(string $option_key, string $default) : string
Parameters
- $option_key : string
-
The advanced setting key (e.g., 'bnpl_product_location')
- $default : string
-
Default value if not set
Return values
stringrender_cart_location()
private
render_cart_location(mixed $location, mixed $template) : mixed
Parameters
- $location : mixed
- $template : mixed
render_product_location()
private
render_product_location(mixed $location) : mixed
Parameters
- $location : mixed
render_shop_location()
private
render_shop_location(mixed $location) : mixed
Parameters
- $location : mixed