Skip to content
Docs
Get RestroPress

Filter

rpress_checkout_ui_vars

Updated
On this page

Filters the strings and settings localised to the checkout UI script.

Runs on the checkout page when RP_Frontend_Scripts::load_scripts() passes the data to the rp-checkout-ui script as the rpress_checkout_ui JavaScript object. The array holds UI labels (place_order, coupon_remove, error messages and similar), the support link, the delivery and pickup sub labels, and a gateways map describing sub text and icon for each gateway. Add or change keys to customise the checkout text or to describe extra gateways.

Parameters#

ParameterTypeDescription
$varsarrayCheckout UI data. Keys include place_order, coupon_applied, coupon_remove, support_url, delivery_sub, pickup_sub and gateways.

Return value#

array. The data passed to wp_localize_script() for the rpress_checkout_ui object.

Example#

function my_checkout_ui_vars( $vars ) {
	$vars['place_order'] = __( 'Confirm and pay', 'my-textdomain' );
	$vars['gateways']['my_gateway'] = array(
		'sub'  => __( 'Pay with My Gateway', 'my-textdomain' ),
		'icon' => 'card',
	);
	return $vars;
}
add_filter( 'rpress_checkout_ui_vars', 'my_checkout_ui_vars' );

Notes#

Only runs on the checkout page.

Source#

Applied in:

  • includes/class-rpress-frontend-scripts.php (line 283), in RP_Frontend_Scripts::load_scripts()

See also#

Was this page helpful?