• Resolved Robert_ITman

    (@robert_itman)


    Invoices not attached on subscription orders – I’m using plugin from SUMO Subscriptions and their support replied with: We suggest you to contact the respective plugin author to attach invoices to our emails using the below hook,

    sumosubscriptions_email_order_meta

    Please help me add this myself using script in functions.php or let me know where to add this in a child theme override file … and/or add this functionality to your next plugin update.

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @robert_itman,

    Thank you for reaching out to us.

    By default, our Challan free version attaches all invoices with WooCommerce primary emails based on order statuses. However, third-party plugins like SUMO Subscriptions’ emails may not have invoices attached.

    To address this, you can use the following custom code snippet to add the functionality using ‘woo_invoice_email_types’ filter:

    add_filter( 'woo_invoice_email_types', 'add_custom_email_type', 10, 1 );
    
    function add_custom_email_type( $email_types ) {
        // Add your email type to the list of allowed statuses
        $email_types[] = 'add your email types here';
        return $email_types;
    }
    

    You can add this code snippet to your theme’s functions.php file or a child theme’s override file. This will enable attaching invoices to subscription order emails triggered by your subscription plugin.

    If you need further assistance or have any questions, feel free to ask.

    Thread Starter Robert_ITman

    (@robert_itman)

    Thank you – that looks promising, but I need your help understanding what to enter for $email_types in your code example to replace ‘add your email types here’ … your website doesn’t help either, though it lists ‘woo_invoice_email_types’ under Filter Hooks – can you provide an example that would work and not crash our websites would be most helpful – your URL (add an example here too):

    https://webappick.com/docs/woo-invoice/customization/action-hooks-of-reference-woo-invoice/

    Hi @robert_itman,

    Thank you for reaching out.

    To clarify, in the code example provided, you need to replace 'add your email types here' with the actual email types you want to add. These email types represent different statuses of orders for which you want to attach invoices.

    For example, if you want to attach invoices to the “subscription_new_order” email type, you would modify the code like this:

    add_filter( 'woo_invoice_email_types', 'add_custom_email_type', 10, 1 );
    
    function add_custom_email_type( $email_types ) {
        // Add 'subscription_new_order' to the list of allowed statuses
        $email_types[] = 'subscription_new_order';
    
        return $email_types;
    }
    

    This code snippet adds “subscription_new_order” to the list of allowed email types for attaching invoices.

    For more assistance, feel free to reach out to us from here.

    Thread Starter Robert_ITman

    (@robert_itman)

    I will try the following and will let you know if it works for me after I receive both “New Subscription Order” and “Subscription?Renewal Success” based on the text in the emails sent … I’m guessing what to use here … any help would be great:

    $email_types[] = 'subscription_new_order';
    $email_types[] = 'new_subscription_order';
    $email_types[] = 'subscription_renewal_success';
    
    • This reply was modified 9 months, 3 weeks ago by Robert_ITman.
    • This reply was modified 9 months, 3 weeks ago by Robert_ITman.

    Hi @robert_itman,
    Sure, feel free to give it a try! If you encounter any issues or need further assistance, please get in touch with us. You can contact us for support and guidance using the following link: Contact Us. We’re here to help!

    Thread Starter Robert_ITman

    (@robert_itman)

    SOLVED thanks to help from Ahmed at Challan and https://fantasticplugins.com/ support desk plugin for SUMO Subscriptions together provided this to add to functions.php

    add_filter( 'woo_invoice_email_types', function( $email_types ) {
    $our_email_types = array(
    'subscription_new_order',
    'subscription_new_order_old_subscribers',
    'subscription_order_processing',
    'subscription_order_completed',
    'subscription_paused',
    'subscription_invoice',
    'subscription_expiry_reminder',
    'subscription_auto_renewal_reminder',
    'subscription_auto_renewal_success',
    'subscription_overdue_automatic',
    'subscription_overdue_manual',
    'subscription_suspended_automatic',
    'subscription_suspended_manual',
    'subscription_turnoff_auto_payments_success',
    'subscription_pending_authorization',
    'subscription_cancelled',
    'subscription_cancel_request_submitted',
    'subscription_cancel_request_revoked',
    'subscription_expired',
    );
    
    $email_types = array_merge( $email_types, $our_email_types );
    return $email_types;
    } );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Invoices not attached on subscription orders’ is closed to new replies.