WC_Admin_Addons::output_wcpay_banner_block()public staticWC 1.0

Deprecated from version 5.9.0. It is no longer supported and can be removed in future releases. Use d in In-App Marketplace instead.

Handles the outputting of the WooCommerce Pay banner block.

Method of the class: WC_Admin_Addons{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Admin_Addons::output_wcpay_banner_block( $block );
$block(object)
Block data.
Default: array()

Changelog

Deprecated since 5.9.0 No longer used in In-App Marketplace

WC_Admin_Addons::output_wcpay_banner_block() code WC 8.6.1

<?php
public static function output_wcpay_banner_block( $block = array() ) {
	$is_active = is_plugin_active( 'woocommerce-payments/woocommerce-payments.php' );
	$location  = wc_get_base_location();

	if (
		! in_array( $location['country'], array( 'US' ), true ) ||
		$is_active ||
		! current_user_can( 'install_plugins' ) ||
		! current_user_can( 'activate_plugins' )
	) {
		return;
	}

	$button_url = wp_nonce_url(
		add_query_arg(
			array(
				'install-addon' => 'woocommerce-payments',
			)
		),
		'install-addon_woocommerce-payments'
	);

	$defaults = array(
		'image'       => WC()->plugin_url() . '/assets/images/wcpayments-icon-secure.png',
		'image_alt'   => __( 'WooPayments', 'woocommerce' ),
		'title'       => __( 'Payments made simple, with no monthly fees &mdash; exclusively for WooCommerce stores.', 'woocommerce' ),
		'description' => __( 'Securely accept cards in your store. See payments, track cash flow into your bank account, and stay on top of disputes – right from your dashboard.', 'woocommerce' ),
		'button'      => __( 'Free - Install now', 'woocommerce' ),
		'href'        => $button_url,
		'logos'       => array(),
	);

	$block_data = array_merge( $defaults, $block );
	?>
	<div class="addons-wcs-banner-block">
		<div class="addons-wcs-banner-block-image">
			<img
				class="addons-img"
				src="<?php echo esc_url( $block_data['image'] ); ?>"
				alt="<?php echo esc_attr( $block_data['image_alt'] ); ?>"
			/>
		</div>
		<div class="addons-wcs-banner-block-content">
			<h1><?php echo esc_html( $block_data['title'] ); ?></h1>
			<p><?php echo esc_html( $block_data['description'] ); ?></p>
			<?php
				self::output_button(
					$block_data['href'],
					$block_data['button'],
					'addons-button-outline-purple'
				);
			?>
		</div>
	</div>
	<?php
}