• Resolved archfabricationandmachine

    (@archfabricationandmachine)


    Hello, I’m having an issue with switching to HPOS in woocommerce.

    I’ve read that you need to use this code to retrieve the order number properly:

    “Instead of referencing $order->id or $order->get_id() when fetching order data, use $order->get_order_number()”

    The issue im having, is the woocommerce admin order page, AND the PDF packing slips i generate with a third party plugin, display the correct order number.

    However, the emails generated by woocommerce, are showing the post id instead of the order number.

    I’ve looked into the emails template, and in the “email-order-details.php” file, it appears to be where it sources the order number. The section of that template where it sources the order number is:

    “/* translators: %1$s: Order ID. %2$s: Order date */ echo wp_kses_post( wc_strtoupper( sprintf( esc_html__( ‘[Order #%1$s] (%2$s)’, ‘woocommerce’ ), $order->get_order_number(), wc_format_datetime( $order->get_date_created() ) ) ) ) . “\n”; echo “\n” . wc_get_email_order_items( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped “

    Which appears to use the correct “$order->get_order_number()” function. however, it displays the post ID in emails, not the custom order number that is displayed in the admin order page.

    Additionally…..the email settings use a variable of {order_number} which retrieves the order number in an unknown way.

    When using the legacy storage, all works fine, but when using HPOS, it doesn’t work properly with woocommerce emails.

    Any insight?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi archfabricationandmachine,

    Thank you for reaching out with the details about the issue you’re experiencing with switching to HPOS in WooCommerce.

    However, we couldn’t replicate the issue when we tested the scenario on our end. We recommend checking the settings and configuration related to the HPOS integration, and also verifying if there are any specific plugins or code snippets affecting the email generation process when using HPOS.

    If the issue persists, kindly share your WooCommerce system status report (WooCommerce>status>system status report) and the screen recording of the scenario via this link to investigate further.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi?archfabricationandmachine,

    As we did not receive any response or follow-up questions from you, we will assume you got this working to your requirements. If you still have any more questions for us, please open a new thread, because we will mark this one as resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Emails sending Post ID insead of order number’ is closed to new replies.