Support » Plugin: License Manager for WooCommerce » How to send Digital Key In Separate email ?

  • Resolved krgauravit007

    (@krgauravit007)


    Hi,

    I am using your plugin. I see it sends key inline with Completed Order email Notification.

    How Can I send as separate email?

    Pl advice.

    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Drazen Bebic

    (@drazenbebic)

    Hello @krgauravit007

    thank you for your message and for using my plugin.

    There is a separate email which only sends the license keys. It can be sent when you open the order and click on the “Send license key(s) to customer” order action.

    You can read more about that in the docs found here: https://www.licensemanager.at/docs/handbook/woocommerce-orders/resend-license-keys/

    krgauravit007

    (@krgauravit007)

    Thanks for responding.

    I am aware of this. Can it be executed at the time of order completion without automatically by hook or custom function ?

    Regards

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @krgauravit007

    You can use the following method provided by WooCommerce, since this is a WooCommerce email:

    WC()->mailer()->emails['LMFWC_Customer_Deliver_License_Keys']->trigger($order->get_id(), $order);

    $order refers to a WC_Order object, which you can get if you have the order ID with wc_get_order()

    krgauravit007

    (@krgauravit007)

    Thanks,

    Can u please develop full codes so that I can put in function file. It would be great help.

    Thanks.

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @krgauravit007

    add_action('woocommerce_order_status_completed', function($orderId) {
        $order = wc_get_order($orderId);
                
        if (!$order) {
            return;
        }
    
       WC()->mailer()->emails['LMFWC_Customer_Deliver_License_Keys']->trigger($order->get_id(), $order);
    });

    Let me know if that works for you.

    krgauravit007

    (@krgauravit007)

    Hi,

    Thanks for code

    It sent auto email but key was missing in email . It added product name in table format.

    Regards

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @krgauravit007

    that might be a priority issue, try the following:

    add_action('woocommerce_order_status_completed', function($orderId) {
        $order = wc_get_order($orderId);
                
        if (!$order) {
            return;
        }
    
       WC()->mailer()->emails['LMFWC_Customer_Deliver_License_Keys']->trigger($order->get_id(), $order);
    }, 1, 1);
    krgauravit007

    (@krgauravit007)

    It’s same as pervious. It is including only product name and not key.

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @krgauravit007

    Are you using the latest plugin version (2.2.0)?

    krgauravit007

    (@krgauravit007)

    Yes – Version 2.2.0

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @krgauravit007

    found the problem: The hook was firing too early, before the licenses were generated. Change the priority parameter to 11, if that doesn’t work, try a higher number (50, 100, 1000, 5000, etc). Here’s an example:

    add_action('woocommerce_order_status_completed', function($orderId) {
        $order = wc_get_order($orderId);
                
        if (!$order) {
            return;
        }
    
       WC()->mailer()->emails['LMFWC_Customer_Deliver_License_Keys']->trigger($order->get_id(), $order);
    }, 11, 1);

    Hello

    I borrow this thread =)

    I have used license key for a long time.
    now yesterday i updated to the latest update and having problems inporting the codes license i sell.

    “License Manager: There was a problem importing the license keys.” This is the error i recieve?

    ANy hints that you know why it does this now =) ?

    Best
    VB

    Plugin Author Drazen Bebic

    (@drazenbebic)

    Hello @vbrae

    Thank you for your message and for using my plugin.

    Please check this thread:

    https://wordpress.org/support/topic/no-generation-after-update/

    It could be that your migration failed. Please verify that you have the user_id column in the lmfwc_licenses table.

    jenifer221091

    (@jenifer221091)

    where do you add this code

    add_action('woocommerce_order_status_completed', function($orderId) {
        $order = wc_get_order($orderId);
                
        if (!$order) {
            return;
        }
    
       WC()->mailer()->emails['LMFWC_Customer_Deliver_License_Keys']->trigger($order->get_id(), $order);
    }, 11, 1);
    Plugin Author Drazen Bebic

    (@drazenbebic)

    @jenifer221091

    You can add it to the end of your theme’s functions.php file.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.