WC_Helper::wccom_activate
Activate the product subscription to WCCOM
Метод класса: WC_Helper{}
Хуков нет.
Возвращает
Массив.
Использование
$result = WC_Helper::wccom_activate( $product_key ): array;
- $product_key(строка) (обязательный)
- the product key to be activated.
Код WC_Helper::wccom_activate() WC Helper::wccom activate WC 10.5.2
protected static function wccom_activate( $product_key ): array {
$activation_response = WC_Helper_API::post(
'activate',
array(
'authenticated' => true,
'body' => wp_json_encode(
array(
'product_key' => $product_key,
)
),
)
);
$activated = wp_remote_retrieve_response_code( $activation_response ) === 200;
$body = json_decode( wp_remote_retrieve_body( $activation_response ), true );
if ( ! $activated && ! empty( $body['code'] ) && 'already_connected' === $body['code'] ) {
$activated = true;
}
return array( $activation_response, $activated, $body );
}