• Resolved manu225

    (@manu225)


    Hi,

    I use this plugin for generating licenses my pro WordPress plugins.
    It works fine but i got one problem: some license can be used on multiple websites.
    And when the license gonna expire, the custmoer renew it by ordering again the same product. But by this way they got a new license key, and it’s not very convenient to change manually their license key on every website.
    So my question: is there a way to just extends the license key expire date when a customer order a product and have already a license generated for this product?

    Thanks you!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter manu225

    (@manu225)

    So i have found a solution, i don’t know if it’s the best way to that but it works.
    I used the action lmfwc_event_post_order_license_keys that is triggered after a license is generated.
    I check if the customer has already bought a license for the product. If yes i just replace the license key of the new generated license by the older one (and i remove the expired license).

    • This reply was modified 3 years, 8 months ago by manu225.
    • This reply was modified 3 years, 8 months ago by manu225.

    Can you send us your snippet?

    Thread Starter manu225

    (@manu225)

    I can’t post my entire code cause it’s complex because done for my usage (with some specific license key formats).
    But you can use something like this in your functions.php of your theme:

    use LicenseManagerForWooCommerce\Repositories\Resources\License as LicenseResourceRepository;
    
    add_action('lmfwc_event_post_order_license_keys', function($args) {
    
        $orderId = $args['orderId'];
        $licenses = $args['licenses'];
    
        foreach ($licenses as $license) {
    
            //do what you need to do here for each licenses
    
        }
    
    }

    Action lmfwc_event_post_order_license_keys is triggered after an order is completed.

    • This reply was modified 3 years, 7 months ago by manu225.

    I check if the customer has already bought a license for the product. If yes i just replace the license key of the new generated license by the older one (and i remove the expired license).

    i like to have that to but dont know what code to use to replace a license if someone already got it for same product can u guide me

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Extends licence expire date’ is closed to new replies.