Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Suborder

Restrict the suborder mails #

/**
** suborder email restriction
**/
add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'customer_email_recipient_change',10,2);
add_filter( 'woocommerce_email_recipient_customer_processing_order', 'customer_email_recipient_change',10,2);
function customer_email_recipient_change( $recipient_name , $object_name ){
   $parent_order_id = wp_get_post_parent_id( $object_name->get_id() );
   if( $parent_order_id == 0 ) {
       return $recipient_name;
   } else {
       return;
   }
}

Trigger suborder mail only #

add_filter( 'woocommerce_email_recipient_customer_refunded_order', 'disable_email_for_sub_order', 10,3 );
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'disable_email_for_sub_order', 10,3 );
add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'disable_email_for_sub_order', 10,3 );

add_filter( 'woocommerce_email_recipient_customer_processing_order', 'disable_email_for_sub_order', 10,3 );
function disable_email_for_sub_order( $recipient, $order, $object ){
   if( wp_get_post_parent_id( $order->get_id() ) ){
      return $recipient;
   } else {
      return;
   }
}

Remove suborder from the My Account page #

/**** Remove Suborder from coustomer my-account page *****/
add_filter( 'woocommerce_account_orders_columns' , function( $suborders ) {
    unset( $suborders['mvx_suborder'] );
    return $suborders;
  } , 999 );

Leave a Reply