Title: Auto Activate
Last modified: January 21, 2022

---

# Auto Activate

 *  Resolved [CaptainMorgan](https://wordpress.org/support/users/davehealey/)
 * (@davehealey)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/auto-activate/)
 * Is it possible make the license auto-activate one time on delivery?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/auto-activate/#post-15283814)
 * Hi [@davehealey](https://wordpress.org/support/users/davehealey/)
    At the moment
   this feature is not available but in the setting, there is an option: Allow users
   to activate their license keys.
 * Please see the screenshot in the below link.
 * [https://www.awesomescreenshot.com/image/20742420?key=4e20d34b1868c51d8ed4b728efeca266](https://www.awesomescreenshot.com/image/20742420?key=4e20d34b1868c51d8ed4b728efeca266)
 * Thanks
 *  Thread Starter [CaptainMorgan](https://wordpress.org/support/users/davehealey/)
 * (@davehealey)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/auto-activate/#post-15284018)
 * Hello,
 * Thanks, is it possible to hook into this with the API to enable the license after
   it’s been delivered?
 *  [A.Tariq](https://wordpress.org/support/users/arsalantariq/)
 * (@arsalantariq)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/auto-activate/#post-15287081)
 * [@davehealey](https://wordpress.org/support/users/davehealey/)
    Seems like it’s
   possible but it’s custom work and you need any developer help to achieve this
   work.
 * thanks
 *  Thread Starter [CaptainMorgan](https://wordpress.org/support/users/davehealey/)
 * (@davehealey)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/auto-activate/#post-15393344)
 * For anyone else who wants this, here is the snippet you need.
 *     ```
       add_action('lmfwc_event_post_order_license_keys', 'auto_activate_key');
   
       function auto_activate_key( $args ) {
   
       	$orderId = $args['orderId'];
         	$licenses = $args['licenses'];
   
       	foreach ($licenses as $license) {
       		lmfwc_activate_license( $license->getDecryptedLicenseKey() );
         	}
       }
       ```
   
 *  Thread Starter [CaptainMorgan](https://wordpress.org/support/users/davehealey/)
 * (@davehealey)
 * [4 years ago](https://wordpress.org/support/topic/auto-activate/#post-15644414)
 * [@arsalantariq](https://wordpress.org/support/users/arsalantariq/) The snippet
   I put in my last post is working well except it seems the $licenses array only
   ever has one value in it even when there are multiple licenses in the order. 
   So only the first license in the order is getting activated. Am I doing something
   wrong?
 *  Thread Starter [CaptainMorgan](https://wordpress.org/support/users/davehealey/)
 * (@davehealey)
 * [4 years ago](https://wordpress.org/support/topic/auto-activate/#post-15647634)
 * Ok I found a new solution
 *     ```
       add_action('lmfwc_event_post_order_license_keys', 'auto_activate_key');
   
       function auto_activate_key( $args ) {
   
       	$orderId = $args['orderId'];
   
       	LicenseManagerForWooCommerce\Repositories\Resources\License::instance()->updateBy(
       		array('order_id' => $orderId),
       		array('times_activated' => 1)
       	);
       }
       ```
   
 *  [M Haseeb](https://wordpress.org/support/users/haseeb0001/)
 * (@haseeb0001)
 * [4 years ago](https://wordpress.org/support/topic/auto-activate/#post-15653148)
 * [@davehealey](https://wordpress.org/support/users/davehealey/) Great, thanks 
   for your support 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Auto Activate’ is closed to new replies.

 * ![](https://ps.w.org/license-manager-for-woocommerce/assets/icon-256x256.gif?
   rev=2824216)
 * [License Manager for WooCommerce](https://wordpress.org/plugins/license-manager-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/license-manager-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/license-manager-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/license-manager-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/license-manager-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/license-manager-for-woocommerce/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [M Haseeb](https://wordpress.org/support/users/haseeb0001/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/auto-activate/#post-15653148)
 * Status: resolved