Resend email error notice
-
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.
- The topic ‘Resend email error notice’ is closed to new replies.