WooCommerce Code Reference
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • WooCommerce Docs
  • REST API Docs

Packages

  • None
  • WooCommerce
    • Abstracts
    • Admin
      • Customize
      • Functions
      • Importers
      • Meta
      • Reports
      • System
    • API
    • Classes
      • Data
        • Store
      • Emails
      • Embed
      • Integrations
      • Interfaces
      • Log
        • Handlers
      • Payment
      • Products
      • Shipping
      • Walkers
    • Export
    • Functions
    • Import
    • l10n
    • PaymentTokens
    • PayPal
    • Shortcodes
      • Cart
      • Checkout
      • My
        • Account
      • Order
        • Tracking
    • Webhooks
    • Widgets
  • WP-Background-Processing

Classes

  • WC_API
  • WC_API_Taxes
  • WC_API_XML_Handler
  • WC_Auth
  • WC_Legacy_API
  • WC_REST_Authentication
  • WC_REST_Coupons_Controller
  • WC_REST_Coupons_V1_Controller
  • WC_REST_Customer_Downloads_Controller
  • WC_REST_Customer_Downloads_V1_Controller
  • WC_REST_Customers_Controller
  • WC_REST_Customers_V1_Controller
  • WC_REST_Legacy_Coupons_Controller
  • WC_REST_Legacy_Orders_Controller
  • WC_REST_Legacy_Products_Controller
  • WC_REST_Order_Notes_Controller
  • WC_REST_Order_Notes_V1_Controller
  • WC_REST_Order_Refunds_Controller
  • WC_REST_Order_Refunds_V1_Controller
  • WC_REST_Orders_Controller
  • WC_REST_Orders_V1_Controller
  • WC_REST_Payment_Gateways_Controller
  • WC_REST_Product_Attribute_Terms_Controller
  • WC_REST_Product_Attribute_Terms_V1_Controller
  • WC_REST_Product_Attributes_Controller
  • WC_REST_Product_Attributes_V1_Controller
  • WC_REST_Product_Categories_Controller
  • WC_REST_Product_Categories_V1_Controller
  • WC_REST_Product_Reviews_Controller
  • WC_REST_Product_Reviews_V1_Controller
  • WC_REST_Product_Shipping_Classes_Controller
  • WC_REST_Product_Shipping_Classes_V1_Controller
  • WC_REST_Product_Tags_Controller
  • WC_REST_Product_Tags_V1_Controller
  • WC_REST_Product_Variations_Controller
  • WC_REST_Products_Controller
  • WC_REST_Products_V1_Controller
  • WC_REST_Report_Sales_Controller
  • WC_REST_Report_Sales_V1_Controller
  • WC_REST_Report_Top_Sellers_Controller
  • WC_REST_Report_Top_Sellers_V1_Controller
  • WC_REST_Reports_Controller
  • WC_REST_Reports_V1_Controller
  • WC_REST_Setting_Options_Controller
  • WC_REST_Settings_Controller
  • WC_REST_Shipping_Methods_Controller
  • WC_REST_Shipping_Zone_Locations_Controller
  • WC_REST_Shipping_Zone_Methods_Controller
  • WC_REST_Shipping_Zones_Controller
  • WC_REST_Shipping_Zones_Controller_Base
  • WC_REST_System_Status_Controller
  • WC_REST_System_Status_Tools_Controller
  • WC_REST_Tax_Classes_Controller
  • WC_REST_Tax_Classes_V1_Controller
  • WC_REST_Taxes_Controller
  • WC_REST_Taxes_V1_Controller
  • WC_REST_Webhook_Deliveries_Controller
  • WC_REST_Webhook_Deliveries_V1_Controller
  • WC_REST_Webhooks_Controller
  • WC_REST_Webhooks_V1_Controller

Exceptions

  • WC_REST_Exception

Class WC_REST_Authentication

Package: WooCommerce\API
Author: WooThemes
Located at api/class-wc-rest-authentication.php

Methods summary

public
# __construct( )

Initialize authentication actions.

Initialize authentication actions.

protected boolean
# is_request_to_rest_api( )

Check if is request to our REST API.

Check if is request to our REST API.

Returns

boolean
public integer|false
# authenticate( integer|false $user_id )

Authenticate user.

Authenticate user.

Parameters

$user_id
User ID if one has been determined, false otherwise.

Returns

integer|false
public WP_Error|null|boolean
# check_authentication_error( WP_Error|null|boolean $error )

Check for authentication error.

Check for authentication error.

Parameters

$error

Returns

WP_Error|null|boolean
protected
# set_error( WP_Error $error )

Set authentication error.

Set authentication error.

Parameters

$error
Authentication error data.
protected WP_Error|null.
# get_error( )

Get authentication error.

Get authentication error.

Returns

WP_Error|null.
public array
# parse_header( string $header )

Parse the Authorization header into parameters.

Parse the Authorization header into parameters.

Parameters

$header
Authorization header value (not including "Authorization: " prefix).

Returns

array
Map of parameter values.

Since

3.0.0
public string
# get_authorization_header( )

Get the authorization header.

Get the authorization header.

On certain systems and configurations, the Authorization header will be stripped out by the server or PHP. Typically this is then used to generate PHP_AUTH_USER/PHP_AUTH_PASS but not passed on. We use getallheaders here to try and grab it out instead.

Returns

string
Authorization header if set.

Since

3.0.0
public array|WP_Error
# get_oauth_parameters( )

Get oAuth parameters from $_GET, $_POST or request header.

Get oAuth parameters from $_GET, $_POST or request header.

Returns

array|WP_Error

Since

3.0.0
public WP_REST_Response
# send_unauthorized_headers( WP_REST_Response $response )

If the consumer_key and consumer_secret $_GET parameters are NOT provided and the Basic auth headers are either not present or the consumer secret does not match the consumer key provided, then return the correct Basic headers and an error message.

If the consumer_key and consumer_secret $_GET parameters are NOT provided and the Basic auth headers are either not present or the consumer secret does not match the consumer key provided, then return the correct Basic headers and an error message.

Parameters

$response
Current response being served.

Returns

WP_REST_Response
public mixed
# check_user_permissions( mixed $result, WP_REST_Server $server, WP_REST_Request $request )

Check for user permissions and register last access.

Check for user permissions and register last access.

Parameters

$result
Response to replace the requested version with.
$server
Server instance.
$request
Request used to generate the response.

Returns

mixed

Properties summary

protected WP_Error $error

Authentication error.

Authentication error.

# null
protected stdClass $user

Logged in user data.

Logged in user data.

# null
protected string $auth_method

Current auth method.

Current auth method.

# ''
WooCommerce Code Reference API documentation generated by ApiGen