WC_Helper_Updater::get_purchase_notice
Message for a plugin whose product the connected account holds no subscription for.
Links to the product page so the reader can see what a subscription covers before buying. Falls back to the cart when the update data carries no product URL.
Метод класса: WC_Helper_Updater{}
Хуков нет.
Возвращает
string.
Использование
$result = WC_Helper_Updater::get_purchase_notice( $product_id, $product_page_url, $campaign_prefix ): string;
- $product_id(int) (обязательный)
- WooCommerce.com product ID.
- $product_page_url(строка) (обязательный)
- WooCommerce.com product page URL, or an empty string.
- $campaign_prefix(строка) (обязательный)
- Prefix for the link's utm_campaign value.
Список изменений
| С версии 11.2.0 | Введена. |
Код WC_Helper_Updater::get_purchase_notice() WC Helper Updater::get purchase notice WC 11.2.1
private static function get_purchase_notice( int $product_id, string $product_page_url, string $campaign_prefix ): string {
$purchase_link = '' !== $product_page_url
? add_query_arg(
array(
'utm_source' => 'pu',
'utm_campaign' => $campaign_prefix . '_purchase',
),
$product_page_url
)
: add_query_arg(
array(
'add-to-cart' => $product_id,
'utm_source' => 'pu',
'utm_campaign' => $campaign_prefix . '_purchase',
),
PluginsHelper::WOO_CART_PAGE_URL
);
return sprintf(
/* translators: 1: URL of the WooCommerce.com product page */
__( 'You don\'t have an active subscription for this product. <a href="%1$s" class="woocommerce-purchase-subscription">Subscribe</a> now for security updates, product improvements, and support.', 'woocommerce' ),
esc_url( $purchase_link )
);
}