WC_Helper::_helper_subscription_activate()
Active a product subscription.
Method of the class: WC_Helper{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WC_Helper::_helper_subscription_activate();
WC_Helper::_helper_subscription_activate() WC Helper:: helper subscription activate code WC 9.3.1
private static function _helper_subscription_activate() { $product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : ''; $product_id = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0; if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'activate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized self::log( 'Could not verify nonce in _helper_subscription_activate' ); wp_die( 'Could not verify nonce' ); } try { $activated = self::activate_helper_subscription( $product_key, $product_id ); } catch ( Exception $e ) { $activated = false; } $redirect_uri = add_query_arg( array( 'page' => 'wc-addons', 'section' => 'helper', 'filter' => self::get_current_filter(), 'wc-helper-status' => $activated ? 'activate-success' : 'activate-error', 'wc-helper-product-id' => $product_id, ), admin_url( 'admin.php' ) ); wp_safe_redirect( $redirect_uri ); die(); }