Dev Resources

  • Home
  • Reference
  • BuddyX Theme
  • Functions
  • Hooks
  • Classes
Filter by type:
Search
Browse: Home / Reference / Classes / WC_Email_New_Order / WC_Email_New_Order::trigger()

WC_Email_New_Order::trigger( int $order_id, WC_Order|false $order = false )

Trigger the sending of this email.

Contents

  • Description
    • Parameters
    • Source
  • Related
    • Uses
  • User Contributed Notes

Description #Description


Parameters #Parameters

$order_id

(Required) The order ID.

$order

(Optional) Order object.

Default value: false


Top ↑

Source #Source

File: includes/emails/class-wc-email-new-order.php

		public function trigger( $order_id, $order = false ) {
			$this->setup_locale();

			if ( $order_id && ! is_a( $order, 'WC_Order' ) ) {
				$order = wc_get_order( $order_id );
			}

			if ( is_a( $order, 'WC_Order' ) ) {
				$this->object                         = $order;
				$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();
		}

Expand full source code Collapse full source code


Top ↑

Related #Related

Top ↑

Uses #Uses

Uses
Uses Description
includes/emails/class-wc-email-new-order.php: woocommerce_new_order_email_allows_resend

Controls if new order emails can be resend multiple times.

includes/wc-formatting-functions.php: wc_format_datetime()

Format a date for output.

includes/wc-order-functions.php: wc_get_order()

Main function for returning orders, uses the WC_Order_Factory class.


Top ↑

User Contributed Notes #User Contributed Notes

You must log in before being able to contribute a note or feedback.

Proudly powered by WordPress