Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! I’m sorry to hear it’s not working for you. We have seen similar reports before, which to date have all been traced to a specific payment gateway plugin, MultiSafePay. This issue was addressed in an update of their plugin long ago, but because they don’t host their plugin on www.ads-software.com, updates need to be installed manually.

    That said, even if you are not using MultiSafePay (which is a PSP that operates mostly in the Netherlands), it’s possible that other plugins influence the email process in a way that either makes it impossible for the PDF invoice plugin to attach the invoice in time, or even strips any attachments that may have been included by other plugins like the PDF invoices & packing slips plugin. In that sense, the automatic email process is/can be somewhat different from the manual process.

    With the above information in mind, some questions that may help find the source of this issue:

    • Are you using any plugins that may influence WooCommerce emails?
    • Which PSP / payment gateway plugins do you use?
    • Do you have a staging site where you can test for plugin conflicts by turning off WooCommerce plugins one by one?
    • Do you have any actions/filters in place that may restrict email attachments? When the admin email is sent, the status of the order will always be ‘pending’
    • Is this only affecting the admin email or also other emails?

    Let us know and we’ll do our best to help!

    Thread Starter bluebirdwebdev

    (@bluebirdwebdev)

    Hi Ewout,

    Thanks for the prompt reply.

    I don’t use the MultiSafePay payment plugin.

    I don’t use your plugin to generate any other emails (eg packing slips) so can’t say whether or not this is occurring elsewhere.

    I don’t have a staging site set up, but could potentially look at doing this to help rule out plugin conflicts.

    I must admit, the functionality was working correctly up until a point that it wasn’t… Not helpful I know, however I can’t recall at what point it stopped working or if any new plugins were installed that caused it to stop it working.

    Here is a list of what is installed:

    Better Font Awesome
    Contact Form 7
    Duplicate Post
    Flamingo
    Google Analytics Dashboard for WP (GADWP)
    Postcode Based Order Restriction
    Really Simple SSL
    Compress JPEG & PNG images
    UpdraftPlus – Backup/Restore
    User Role Editor
    User Switching
    WooCommerce Invoice Gateway
    WooCommerce No Shipping Message
    White Label CMS
    WooCommerce Shipping Method Display Style
    WooCommerce Click Gateway
    WooCommerce PDF Invoices & Packing Slips
    WooCommerce Table Rate Shipping
    WooCommerce Wholesale Prices Premium
    WooCommerce Wholesale Prices
    WooCommerce
    WooSidebars
    Wordfence Security
    Yoast SEO

    Here is a list of some changes to the function.php file in my child theme. However I am unsure how these would affect the PDF invoice attaching to the email.

    
    /**
     * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE
     */
    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_paid_order', 10, 1 );
    function custom_woocommerce_auto_complete_paid_order( $order_id ) {
      if ( ! $order_id )
        return;
    
      $order = wc_get_order( $order_id );
    
      // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
      if ( ( 'invoice' == get_post_meta($order_id, '_payment_method', true) ) || ( 'cod' == get_post_meta($order_id, '_payment_method', true) ) || ( 'cheque' == get_post_meta($order_id, '_payment_method', true) ) ) {
        return;
      } 
      // "completed" updated status for paid Orders with all others payment methods
      else {
        $order->update_status( 'completed' );
      }
    }
    
    /**
     * Format order number with invoice number settings
     */
    add_filter( 'wpo_wcpdf_raw_document_number', 'wpo_wcpdf_raw_document_number', 10, 4 );
    function wpo_wcpdf_raw_document_number( $number, $settings, $document, $order ) {
        if ( $document->get_type() == 'invoice' ) {
            $number = $order->get_order_number();
        }
     
        return $number;
    }
    
    /**
    * @snippet Notice with $$$ remaining to Free Shipping @ WooCommerce Cart
    */
     
    function bbloomer_free_shipping_cart_notice_zones() {
     
    global $woocommerce;
     
    // Get Free Shipping Methods for Rest of the World Zone & populate array $min_amounts
     
    $default_zone = new WC_Shipping_Zone(0);
    $default_methods = $default_zone->get_shipping_methods();
     
    foreach( $default_methods as $key => $value ) {
        if ( $value->id === "free_shipping" ) {
          if ( $value->min_amount > 0 ) $min_amounts[] = $value->min_amount;
        }
    }
     
    // Get Free Shipping Methods for all other ZONES & populate array $min_amounts
     
    $delivery_zones = WC_Shipping_Zones::get_zones();
     
    foreach ( $delivery_zones as $key => $delivery_zone ) {
      foreach ( $delivery_zone['shipping_methods'] as $key => $value ) {
        if ( $value->id === "free_shipping" ) {
        if ( $value->min_amount > 0 ) $min_amounts[] = $value->min_amount;
        }
      }
    }
     
    // Find lowest min_amount
     
    if ( is_array($min_amounts) ) {
     
    $min_amount = min($min_amounts);
     
    // Get Cart Subtotal inc. Tax excl. Shipping
     
    $current = WC()->cart->subtotal;
     
    // If Subtotal < Min Amount Echo Notice
    // and add "Continue Shopping" button
     
    if ( $current < $min_amount ) {
    $added_text = esc_html__('Get free shipping if you spend ', 'woocommerce' ) . wc_price( $min_amount - $current ) . esc_html__(' more!', 'woocommerce' );
    $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
    $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue Shopping', 'woocommerce' ), $added_text );
    wc_print_notice( $notice, 'notice' );
    }
     
    }
     
    }
     
    add_action( 'woocommerce_before_cart', 'bbloomer_free_shipping_cart_notice_zones' );
    
    ?>
    Plugin Contributor Ewout

    (@pomegranate)

    Thanks for sharing that information. Could try try to turn of the two payment gateway plugins temporarily to see if that resolves the issue?

    • WooCommerce Invoice Gateway
    • WooCommerce Click Gateway

    If the Click Gateway is this plugin it’s a candidate because it hasn’t been updated since 2016.04.26 and not even properly compatible with WooCommerce 3.0.

    I don’t see anything in the actions/filters either that would influence the attachments.

    I don’t use your plugin to generate any other emails (eg packing slips) so can’t say whether or not this is occurring elsewhere.

    It would be great if you can test this by attaching the invoice to for example the processing email to see if that works. That way we can rule out any issues specifically related to the admin new order email

    Thread Starter bluebirdwebdev

    (@bluebirdwebdev)

    Hi Ewout,

    Firstly, I should mention that while the invoice payment gateway is installed, it isn’t an active/enabled payment method.

    I have some interesting things to report back:

    Click Disabled – Only enabled payment option = Cash on Delivery
    – Admin email successfully automatically attaches PDF invoice

    Click Enabled, but chosen payment option = Cash on Delivery
    – Admin email successfully automatically attaches PDF invoice
    – Customer completed order email successfully automatically attaches PDF invoice

    Click Enabled, but using a 100% discount voucher to skip payment gateway and automatically refresh to WooCommerce successful order page. Cash on delivery also enabled.
    – Admin email successfully automatically attaches PDF invoice
    – Customer completed order email successfully automatically attaches PDF invoice

    Click enabled and a live transaction of $0.10 processed with live credit card details. Cash on delivery disabled.
    – Admin email missing PDF invoice
    – Customer completed order email successfully automatically attaches PDF invoice

    Yes, the payment gateway you linked in your post is the correct one – Click by Paymark. Whilst it hasn’t been updated in a while, it still functions fine, except for this apparent conflict with PDF invoices.

    Plugin Contributor Ewout

    (@pomegranate)

    thank you so much for the thorough report. I think we can successfully conclude that the issue lies with the Click Gateway plugin. That plugin is only used on 50 sites and has not been updated for more than 2 years. As I said, this is simply not properly compatible with WooCommerce 3.0+ (even when you’re not seeing much of that on the surface yet).
    Rather than working with standard WooCommerce endpoints, it has its own system in place that triggers and email when a payment is confirmed by a callback. This appears to be too early when the PDF invoice plugin is not yet loaded.

    I would recommend contacting the plugin developers to ask if they can update their plugin to be compatible with WooCommerce 3.X and perhaps also check this issue (although if they do follow WooCommerce methods it should already be fine). Or maybe look into other gateway plugins? A plugin that is not maintained is a security risk on your site, especially when it comes to payment gateways…

    As an alternative you could also put yourself in CC for the completed order email, to circumvent this issue.

    Hope that helps!

    Thread Starter bluebirdwebdev

    (@bluebirdwebdev)

    I’ll ask Paymark to look at their plugin, but I doubt they will update it given they haven’t maintained it to date…

    In the meantime I’ve set up the BCC functionality, which is successfully delivering the customer’s confirmed order email with attachment.

    Just seems odd that it was working, and then all of a sudden wasn’t. Must have been a WooCommerce update that broke things, given the Paymark plugin is that old.

    Anyhow, thanks Ewout for your prompt support, very professional as always and most appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Order Notification Email Not Attaching PDF’ is closed to new replies.