WC_Helper_Updater::display_notice_for_plugins_without_subscription()public staticWC 1.0

Runs on in_plugin_update_message-{file-name}, show a message if plugin is without a subscription. Only Woo local plugins are passed to this function.

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

Хуков нет.

Возвращает

null..

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

$result = WC_Helper_Updater::display_notice_for_plugins_without_subscription( $plugin_data, $response );
$plugin_data(объект) (обязательный)
An array of plugin metadata.
$response(объект) (обязательный)
An object of metadata about the available plugin update.

Заметки

  • Смотрите: setup_message_for_plugins_without_subscription

Код WC_Helper_Updater::display_notice_for_plugins_without_subscription() WC 9.4.2

public static function display_notice_for_plugins_without_subscription( $plugin_data, $response ) {
	// Extract product ID from the response.
	$product_id = preg_replace( '/[^0-9]/', '', $response->id );

	if ( WC_Helper::has_product_subscription( $product_id ) ) {
		return;
	}

	// Prepare the expiry notice based on subscription status.
	$purchase_link = add_query_arg(
		array(
			'add-to-cart'  => $product_id,
			'utm_source'   => 'pu',
			'utm_campaign' => 'pu_plugin_screen_purchase',
		),
		PluginsHelper::WOO_CART_PAGE_URL,
	);

	$notice = sprintf(
		/* translators: 1: URL to My Subscriptions page */
		__( ' You don\'t have a subscription, <a href="%1$s" class="woocommerce-purchase-subscription">subscribe</a> to update.', 'woocommerce' ),
		esc_url( $purchase_link ),
	);

	// Display the expiry notice.
	echo wp_kses(
		$notice,
		array(
			'a' => array(
				'href'  => array(),
				'class' => array(),
			),
		)
	);
}