Communicating PDF Passwords to Customers: Best Practices for WooCommerce

A few emails came in recently asking about how to let customers know their PDFs are password-protected. We definitely want to avoid any confusion or frustration caused by customers receiving passworded PDFs and not knowing what their password is. When it comes to sharing passwords, especially for PDF files, clear communication is essential. Website administrators often share passwords automatically with users and customers, but this can lead to confusion if the password is not clearly and repeatedly communicated. If the message is sent once, it is highly likely the customer will miss it. Who reads anymore these days, right? (It’s amazing you’re even reading this!)

One person in particular wanted to know how to change the pop-up alert in her PDF reader to let users know that their password was their email address. Unfortunately, there is no such thing as PDF syntax which signals a PDF reader to display different wording in its password pop-up. While that would be neat, it’d likely be buggy anyway, since there are numerous PDF reader applications (like Acrobat, Foxit, Nitro, Preview, and various browsers), each with its own way of displaying alerts.

Another user was curious about how to modify the wording on the WooCommerce Thank You page and in order confirmation emails. Now this is possible – so keep reading!

Ways to Communicate Passwords in WooCommerce

For those running a WooCommerce shop, below are some effective strategies to ensure your customers know their PDF passwords.

Customizing the Thank You Page

To effectively communicate the password, you can customize the Thank You page that customers see after completing their order. Tyches Software provides thorough guidance on how to customize the Thank You page, including using redirects and adding custom functions to WooCommerce hooks. We can even using third-party plugins such as NextMove Lite – Thank You Page for WooCommerce. Using hooks is our favorite, since it allows for the most customization and is less-resistant to breakage.

Using Hooks

You can override the WooCommerce template for the Thank You page by modifying the thankyou.php file located in the plugins/woocommerce/templates/checkout/ folder. Or like we said, you can just use a hook.

Here’s a simple code snippet using the woocommerce_thankyou_order_received_text hook to add a message about the password:

function order_received_text_with_password( $text, $order ) {
    $text = esc_html__( 'Thank you. Your order has been received.', 'woocommerce' );
    $text .= '<br><strong>' . esc_html__( 'Please note!', 'your-text-domain' );
    $text .= '</strong> <em>' . esc_html__( 'Your file download password has been set to your email address.', 'your-text-domain' ) . '</em>';
    return $text;
}
add_filter( 'woocommerce_thankyou_order_received_text', 'order_received_text_with_password', 11, 2 );

This is a very simple example. By adding this code to your (child) theme’s functions.php file, you can ensure that customers see a clear message about their password right on the Thank You page. If you don’t know how to create a child theme or edit your functions.php file using FTP or SSH or even cPanel File Manager, then maybe use the handy Code Snippets plugin to add the PHP code.)

Since the woocommerce_thankyou_order_received_text filter hook — and indeed most hooks included in the checkout and email templates — includes the WooCommerce $order object as a parameter, you can always use the object to fetch information from the order and print it dynamically in your text. For example, this parameter would come in handy if you were using a customer’s phone number or order number as their PDF password. Then you could actually print a password right on the screen with your message. How do you do this? Here’s a leg up at Stack Overflow about how to get order details from an $order object or order ID. If you are still unsure, please ask your developer. It might also benefit you to read through the PHP code below.

function order_received_text_with_phone_password( $text, $order ) {
    // Default Woo text message:
    $text = esc_html__( 'Thank you. Your order has been received.', 'woocommerce' );
    // OK, now get the data from the $order object!
    $order_data = $order->get_data();
    $phone = $order_data['billing']['phone'] ?? '';
    if ( ! empty( $phone ) ) {
        $text .= '<br><em>' . esc_html__( 'WE THOUGHT YOU SHOULD KNOW', 'your-text-domain' );
        $text .= '</em> <strong>' . esc_html__( 'Your PDF password has been set to your phone number:', 'your-text-domain' ) . ' ' . $phone . '</strong>';
    } else {
        error_log( 'Error: No phone number found for order #' . $order_data['id'] );
    }
    return $text;
}
add_filter( 'woocommerce_thankyou_order_received_text', 'order_received_text_with_phone_password', 11, 2 );

Using WooCommerce Order Confirmation Emails

You can customize the order confirmation emails to include the password information. An order confirmation email is usually the first email a customer gets after their purchase. Take advantage of this oft-opened email to let them know their password. Maybe even use bright colors and big letters to draw attention to the password! The easiest way to do this would be with a plugin like Kadence WooCommerce email designer; otherwise try using the built-in WooCommerce settings, or write some custom code if you are inclined for something even more customized.

In the general WooCommerce settings there is an “Emails” tab, where the “Completed order” email template can be adjusted. If you want to send the same message with every purchase, use this settings panel/template. If you understand PHP, you can write the template with more granular control over what is said in what situation. But for many people, this settings field is handy for sharing the news that files are passworded.

Using WooCommerce Purchase Notes

Purchase notes are in order confirmations, nested under each line item in the receipt. To edit these, WooCommerce use the setting for each product under the product “Advanced” tab called “Purchase Note.” You can include details for the customer here, and it will show on the order confirmation page and in order confirmation emails.

WooCommerce product "purchase note" setting screen

Reasons using these settings might not be best is if you:

  • have many products needing different notes
  • want your message to appear elsewhere
  • need to include dynamic data in the note
  • need the note to be translatable

Adding to Woo Email Templates Using Hooks

Inside the plugins/woocommerce/templates/emails/ folder, you’ll find the email-order-details.php file. You can either override and edit the template, or just use action hooks included in the template to add custom text above or below the order details table in the email. Here’s an example:

function password_before_order_table( $order, $sent_to_admin, $plain_text, $email ) {
    $order_data = $order->get_data();
    $phone = $order_data['billing']['phone'];
    echo '<strong>Please note!</strong> Your file download password <em>is your phone number</em>: ' . $phone;
}
add_action( 'woocommerce_email_before_order_table', 'password_before_order_table', 10, 4 );

This code snippet adds a message about the password above the order details in the confirmation email, ensuring that customers are informed. If you wanted the message to be below the order details, you could use the hook woocommerce_email_after_order_table, with the same parameters.

Other Considerations

While many users request features to notify customers of their passwords, we often receive inquiries about changing the appearance or text of the password prompt in PDF readers (e.g. the browser, or Acrobat, etc). Unfortunately, this is beyond our control, as it is determined by the various developers and designers of PDF reader software. Each application has its own way of handling password prompts, and modifying one may not apply to others.

Conclusion

In summary, the best way to inform your customers about their PDF passwords is to communicate clearly and effectively through the order confirmation page and emails. By customizing these templates, you can ensure that customers are well-informed and reduce the likelihood of confusion. Remember to highlight the password information in a way that makes it hard to miss —

bold text, colored fonts, or even larger sizes can help draw attention to this important detail.

By taking these steps, you can enhance the customer experience and ensure that they have the information they need to access their PDF files without frustration. Clear communication not only helps in reducing support inquiries but also builds trust with your customers, making them feel valued and informed. Ultimately, a well-informed customer is a satisfied customer, and that can lead to repeat business and positive word-of-mouth for your WooCommerce shop.

To top