A twist to make it work only for completed order status notifications is to add only this small condition to the IF statement:
$order->has_status( 'completed' )
So first you can try:
if (!$this->has_status( 'completed' ) ){
add_action( 'woocommerce_email_after_order_table', array( $this, 'get_email_barcode' ), 1, 1 );
}
But since I'm not sure to get the $ order ($ this) object there, I looked further in the code for this plugin.
On line 358 , you have the code below where I add the condition.
public function get_email_barcode ( $order ) {
if( ! $order ) return;
if (!$order->has_status( 'completed' ) ) return;
ob_start(); ?>
Here I am sure that this will work since I already received the object . The only thing you will need to add this code again every time you update this plugin. $order
, , . , .