WC_Email_Customer_Note::trigger()publicWC 1.0

Trigger.

Method of the class: WC_Email_Customer_Note{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Email_Customer_Note = new WC_Email_Customer_Note();
$WC_Email_Customer_Note->trigger( $args );
$args(array) (required)
Email arguments.

WC_Email_Customer_Note::trigger() code WC 8.7.0

public function trigger( $args ) {
	$this->setup_locale();

	if ( ! empty( $args ) ) {
		$defaults = array(
			'order_id'      => '',
			'customer_note' => '',
		);

		$args = wp_parse_args( $args, $defaults );

		$order_id      = $args['order_id'];
		$customer_note = $args['customer_note'];

		if ( $order_id ) {
			$this->object = wc_get_order( $order_id );

			if ( $this->object ) {
				$this->recipient                      = $this->object->get_billing_email();
				$this->customer_note                  = $customer_note;
				$this->placeholders['{order_date}']   = wc_format_datetime( $this->object->get_date_created() );
				$this->placeholders['{order_number}'] = $this->object->get_order_number();
			}
		}
	}

	if ( $this->is_enabled() && $this->get_recipient() ) {
		$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
	}

	$this->restore_locale();
}