• Resolved loxlie

    (@loxlie)


    When resending a WooCommerce email for an order, an error is generated. I’ve tracked down why:
    Wt_Advanced_Order_Number’s setup_sequential_number() method hooks woocommerce_before_resend_order_emails to that class’ set_sequential_number() method. That method takes two parameters – $post_id and $post. It tests $post like this:
    ( is_array( $post ) || is_null( $post ) || ( $post->post_type === ‘shop_order’ && $post->post_status !== ‘auto-draft’ ) )
    But WC is passing the order to $post_id (which is fine) and email type – a string – to $post. So that check inevitably fails with a “Trying to get property ‘post_type’ of non-object” notice.
    I’m not sure why it’s hooked at all – I can’t see why the order number should be updated on any email resends – though I haven’t looked into that in detail.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @loxlie,

    Greetings from WebToffee!

    We are sorry for the inconvenience caused and thanks for pointing out the issue. We will check it out and fix it in our upcoming release.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @loxlie,

    Thanks for waiting. We have addressed the mentioned issue in the latest version (v1.4.7) of our plugin. Kindly update the plugin to the latest version and check. Let us know if anything.

    Thread Starter loxlie

    (@loxlie)

    That’s great, thanks.
    I’m still curious as to why it needs hooking to resend emails? (I tried unhooking it, but that stopped number generation for new orders.) Could you briefly explain what’s going on there please?
    BTW I really like the new wt_sequential_is_old_order filter – very handy! We have lots of old imported orders from a previous site and that will help ensure they’re not renumbered.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @loxlie,

    Thanks for getting back in touch.

    We use the hooks woocommerce_new_order, woocommerce_process_shop_order_meta and woocommerce_before_resend_order_emails to generate sequential order numbers. However, in some cases, the first two hooks may fail while creating the order, that’s why we use the woocommerce_before_resend_order_emails hook to handle such situations. This hook fires prior to resending the order emails. Thanks for understanding.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Resend email error notice’ is closed to new replies.