Abstract_WC_Order_Data_Store_CPT::should_suppress_transactional_email_dispatch
Checks whether a transactional email dispatch belongs to the restored order.
Method of the class: Abstract_WC_Order_Data_Store_CPT{}
No Hooks.
Returns
bool.
Usage
// private - for code of main (parent) class only $result = $this->should_suppress_transactional_email_dispatch( $action, $restored_order_id, $args ): bool;
- $action(string) (required)
- The action being dispatched.
- $restored_order_id(int) (required)
- The ID of the order being restored.
- $args(array) (required)
- The runtime action arguments.
Changelog
| Since 10.9.0 | Introduced. |
Abstract_WC_Order_Data_Store_CPT::should_suppress_transactional_email_dispatch() Abstract WC Order Data Store CPT::should suppress transactional email dispatch code WC 11.0.1
private function should_suppress_transactional_email_dispatch( string $action, int $restored_order_id, array $args ): bool {
if ( 0 !== strpos( $action, 'woocommerce_order_status_' ) ) {
return false;
}
$order = $args[1] ?? null;
if ( $order instanceof WC_Order ) {
return $restored_order_id === $order->get_id();
}
$order_id = $args[0] ?? null;
return is_numeric( $order_id ) && $restored_order_id === (int) $order_id;
}