WC_Email_Customer_POS_Refunded_Order::trigger
Trigger the sending of this email.
Method of the class: WC_Email_Customer_POS_Refunded_Order{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Email_Customer_POS_Refunded_Order = new WC_Email_Customer_POS_Refunded_Order(); $WC_Email_Customer_POS_Refunded_Order->trigger( $order_id, $template_id, $refund_id ): void;
- $order_id(int) (required)
- The order ID.
- $template_id(string) (required)
- The email template ID.
- $refund_id(int)
- The refund ID.
Default:null
Changelog
| Since 10.6.0 | Introduced. |
WC_Email_Customer_POS_Refunded_Order::trigger() WC Email Customer POS Refunded Order::trigger code WC 10.7.0
public function trigger( $order_id, $template_id, $refund_id = null ): void {
if ( $this->id !== $template_id ) {
return;
}
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
if ( ! $order instanceof WC_Order ) {
return;
}
$this->setup_locale();
$this->partial_refund = $order->get_remaining_refund_amount() > 0;
$this->object = $order;
$this->recipient = $order->get_billing_email();
$this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() );
$this->placeholders['{order_number}'] = $order->get_order_number();
if ( ! empty( $refund_id ) ) {
$refund = wc_get_order( $refund_id );
$this->refund = $refund instanceof WC_Order_Refund ? $refund : false;
} else {
$this->refund = false;
}
if ( $this->get_recipient() ) {
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
$this->restore_locale();
}