Support » Plugin: WooCommerce » Warning: printf(): Too few arguments in …customer-completed-order.php line 28

  • Resolved rebeccaolson

    (@rebeccaolson)



    Hello – a customer notified me that her “order completed” email had an error code in it:

    Warning: printf(): Too few arguments in …wp-content/themes/Tower-Child/woocommerce/emails/customer-completed-order.php on line 28

    Any ideas? I can’t seem to find any reference to this issue on the internet. I haven’t made any adjustments to that core file. I assume this is a Woocommerce error, rather than a template error. Please let me know if I’m wrong and should ask my template support instead.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 1) I think that your problem could be that the WooCommerce templates in your child theme “Tower-Child” are may be outdated: wp-content/themes/Tower-Child/…

    To be sure, in backend WP settings, go in “Woocommerce” > “System status” (or “Status”). At the end of the page, check in the “Templates” meta-box.

    2) That also can mean that emails/customer-completed-order.php template has been customized and you will need to solve this bug at line 28.

    As reference: Template Structure + Overriding Templates via a Theme

    Thank you – I am contacting my theme support to see if they can help. I did customize the email and have it saved under my child theme. Line 28 reads:

    “<p><?php printf( __( “Hello – we wanted to let you know that your recent order on %s has been completed. When you receive your order, please”

    Can you see the error? The full section of code is:

    “<p><?php printf( __( “Hello – we wanted to let you know that your recent order on %s has been completed. When you receive your order, please take a second to rate the products at http://www.lavenderconnection.com, and we’ll send you a coupon code for 10% off your next purchase! We sincerely value your feedback. Thank you for your business, and we hope to see you again soon! Your order details are shown below for your reference:”, ‘woocommerce’ ), get_option( ‘blogname’ ) ); ?></p>”

    The problem come from 10% in your text using printf() php function.

    You need to escape % character with a second one this way: 10%%

    This will avoid the error

    So your code will be:

    <p><?php printf( __( "Hello – we wanted to let you know that your recent order on %s has been completed. When you receive your order, please take a second to rate the products at http://www.lavenderconnection.com, and we’ll send you a coupon code for 10%% off your next purchase! We sincerely value your feedback. Thank you for your business, and we hope to see you again soon! Your order details are shown below for your reference:", "woocommerce" ), get_option( 'blogname' ) ); ?></p>

    Cheers

    (don’t forget to mark this thread as solved)

    Thank you! That worked perfectly.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning: printf(): Too few arguments in …customer-completed-order.php line 28’ is closed to new replies.