WC_Helper::wccom_activate
Activate the product subscription to WCCOM
Method of the class: WC_Helper{}
No Hooks.
Returns
Array.
Usage
$result = WC_Helper::wccom_activate( $product_key ): array;
- $product_key(string) (required)
- the product key to be activated.
WC_Helper::wccom_activate() WC Helper::wccom activate code WC 10.3.5
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 );
}