Automattic\WooCommerce\Admin

PluginsHelper::get_missing_payment_method_notice()public staticWC 1.0

Get the notice data for missing payment method.

Метод класса: PluginsHelper{}

Хуков нет.

Возвращает

Массив. the notices data.

Использование

$result = PluginsHelper::get_missing_payment_method_notice( $allowed_link, $total_expiring_subscriptions );
$allowed_link(true|false)
whether should show link on the notice or not.
По умолчанию: true
$total_expiring_subscriptions(int)
total expiring subscriptions.
По умолчанию: 1

Код PluginsHelper::get_missing_payment_method_notice() WC 9.3.3

public static function get_missing_payment_method_notice( $allowed_link = true, $total_expiring_subscriptions = 1 ) {
	$add_payment_method_link = add_query_arg(
		array(
			'utm_source'   => 'pu',
			'utm_campaign' => $allowed_link ? 'pu_settings_screen_add_payment_method' : 'pu_in_apps_screen_add_payment_method',
		),
		self::WOO_ADD_PAYMENT_METHOD_URL
	);
	$description             = $allowed_link
		? sprintf(
		/* translators: %s: WooCommerce.com URL to add payment method */
			_n(
				'Your WooCommerce extension subscription is missing a payment method for renewal. <a href="%s">Add a payment method</a> to ensure you continue receiving updates and streamlined support.',
				'Your WooCommerce extension subscriptions are missing a payment method for renewal. <a href="%s">Add a payment method</a> to ensure you continue receiving updates and streamlined support.',
				$total_expiring_subscriptions,
				'woocommerce'
			),
			$add_payment_method_link
		)
		: _n(
			'Your WooCommerce extension subscription is missing a payment method for renewal. Add a payment method to ensure you continue receiving updates and streamlined support.',
			'Your WooCommerce extension subscriptions are missing a payment method for renewal. Add a payment method to ensure you continue receiving updates and streamlined support.',
			$total_expiring_subscriptions,
			'woocommerce'
		);

	return array(
		'description' => $description,
		'button_text' => __( 'Add payment method', 'woocommerce' ),
		'button_link' => $add_payment_method_link,
	);
}