WooCommerce Code Reference

OrderAuthorizationTrait

OrderAuthorizationTrait

Shared functionality for getting order authorization.

Table of Contents

is_authorized()  : bool|WP_Error
Check if authorized to get the order.
validate_billing_email_matches_order()  : mixed
Validate a given billing email against an existing order.

Methods

is_authorized()

Check if authorized to get the order.

public is_authorized(WP_REST_Request $request) : bool|WP_Error
Parameters
$request : WP_REST_Request

Request object.

Tags
throws
RouteException

If the order is not found or the order key is invalid.

Return values
bool|WP_Error

validate_billing_email_matches_order()

Validate a given billing email against an existing order.

public validate_billing_email_matches_order(int $order_id, string $billing_email) : mixed
Parameters
$order_id : int

Order ID.

$billing_email : string

Billing email.

Tags
throws
RouteException

Exception if invalid data is detected.

Return values
mixed