WC_Email_Customer_Review_Request::trigger
Trigger the sending of this email.
Wired to woocommerce_send_review_request, which Action Scheduler fires with the order id as its single argument.
Method of the class: WC_Email_Customer_Review_Request{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Email_Customer_Review_Request = new WC_Email_Customer_Review_Request(); $WC_Email_Customer_Review_Request->trigger( $order_id ): void;
- $order_id(int) (required)
- The order ID.
WC_Email_Customer_Review_Request::trigger() WC Email Customer Review Request::trigger code WC 10.8.1
public function trigger( $order_id ): void {
$this->setup_locale();
// Reset state from any previous invocation so a call with an invalid
// order id cannot re-use the previous recipient / placeholders.
$this->object = false;
$this->recipient = '';
$this->placeholders['{order_date}'] = '';
$this->placeholders['{order_number}'] = '';
$order = $order_id ? wc_get_order( $order_id ) : false;
if ( $order instanceof WC_Order ) {
$this->object = $order;
$this->recipient = $order->get_billing_email();
$date_created = $order->get_date_created();
$this->placeholders['{order_date}'] = $date_created ? wc_format_datetime( $date_created ) : '';
$this->placeholders['{order_number}'] = $order->get_order_number();
}
if ( $this->is_enabled() && $this->get_recipient() && $this->is_order_eligible_for_send() ) {
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
$this->restore_locale();
}