WC_API_Exception::__construct( string $error_code, string $error_message, int $http_status_code )
Setup exception, requires 3 params:
Description #Description
error code – machine-readable, e.g. woocommerce_invalid_product_id
error message – friendly message, e.g. ‘Product ID is invalid’ http status code – proper HTTP status code to respond with, e.g. 400
Parameters #Parameters
- $error_code
-
(Required)
- $error_message
-
(Required) user-friendly translated error message
- $http_status_code
-
(Required) HTTP status code to respond with
Source #Source
File: includes/legacy/api/v2/class-wc-api-exception.php
public function __construct( $error_code, $error_message, $http_status_code ) { $this->error_code = $error_code; parent::__construct( $error_message, $http_status_code ); }
Changelog #Changelog
Version | Description |
---|---|
2.2 | Introduced. |
Related #Related
Used By #Used By
Used By | Description |
---|---|
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_product_by_sku() |
Get product by SKU |
includes/legacy/api/v2/class-wc-api-webhooks.php: WC_API_Webhooks::get_webhook_delivery() |
Get the delivery log for the given webhook ID and delivery ID |
includes/legacy/api/v2/class-wc-api-webhooks.php: WC_API_Webhooks::get_webhooks_count() |
Get the total number of webhooks |
includes/legacy/api/v2/class-wc-api-webhooks.php: WC_API_Webhooks::create_webhook() |
Create an webhook |
includes/legacy/api/v2/class-wc-api-webhooks.php: WC_API_Webhooks::edit_webhook() |
Edit a webhook |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::bulk() |
Bulk update or insert customers Accepts an array with customers in the formats supported by WC_API_Customers->create_customer() and WC_API_Customers->edit_customer() |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::get_customer_by_email() |
Get the customer for the given email |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::get_order_refund() |
Get an order refund for the given order ID and ID |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::create_order_refund() |
Create a new order refund for the given order |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::edit_order_refund() |
Edit an order refund |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::delete_order_refund() |
Delete order refund |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::bulk() |
Bulk update or insert orders Accepts an array with orders in the formats supported by WC_API_Orders->create_order() and WC_API_Orders->edit_order() |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::get_order_note() |
Get an order note for the given order ID and ID |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::create_order_note() |
Create a new order note for the given order |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::edit_order_note() |
Edit the order note |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::delete_order_note() |
Delete order note |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::set_line_item() |
Create or update a line item |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::set_shipping() |
Create or update an order shipping method |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::set_fee() |
Create or update an order fee |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::set_coupon() |
Create or update an order coupon |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::set_item() |
Wrapper method to create/update order items |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::create_order() |
Create an order |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::bulk() |
Bulk update or insert coupons Accepts an array with coupons in the formats supported by WC_API_Coupons->create_coupon() and WC_API_Coupons->edit_coupon() |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::delete_tax_class() |
Delete a tax class |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::get_tax_classes_count() |
Get the total number of tax classes |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::get_taxes_count() |
Get the total number of taxes |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::bulk() |
Bulk update or insert taxes Accepts an array with taxes in the formats supported by WC_API_Taxes->create_tax() and WC_API_Taxes->edit_tax() |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::get_tax_classes() |
Get all tax classes |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::create_tax_class() |
Create a tax class. |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::get_tax() |
Get the tax for the given ID |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::create_tax() |
Create a tax |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::edit_tax() |
Edit a tax |
includes/legacy/api/v3/class-wc-api-taxes.php: WC_API_Taxes::delete_tax() |
Delete a tax |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::create_product_shipping_class() |
Create a new product shipping class. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::edit_product_shipping_class() |
Edit a product shipping class. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::delete_product_shipping_class() |
Delete a product shipping class. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::delete_product_attribute_term() |
Delete a product attribute term. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::bulk() |
Bulk update or insert products Accepts an array with products in the formats supported by WC_API_Products->create_product() and WC_API_Products->edit_product() |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_shipping_classes() |
Get a listing of product shipping classes. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_shipping_class() |
Get the product shipping class for the given ID. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_attribute_terms() |
Get a listing of product attribute terms. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_attribute_term() |
Get the product attribute term for the given ID. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::create_product_attribute_term() |
Create a new product attribute term. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::edit_product_attribute_term() |
Edit a product attribute term. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_product_attribute() |
Get the product attribute for the given ID |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::validate_attribute_data() |
Validate attribute data. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::create_product_attribute() |
Create a new product attribute |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::edit_product_attribute() |
Edit a product attribute |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::delete_product_attribute() |
Delete a product attribute |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_product_attributes() |
Get a listing of product attributes |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::save_product_images() |
Save product images |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::upload_product_image() |
Upload image from URL |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::upload_image_from_url() |
Upload image from URL. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::save_product_meta() |
Save product meta |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_tags() |
Get a listing of product tags. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::get_product_tag() |
Get the product tag for the given ID. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::create_product_tag() |
Create a new product tag. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::edit_product_tag() |
Edit a product tag. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::delete_product_tag() |
Delete a product tag. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_product_categories() |
Get a listing of product categories |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_product_category() |
Get the product category for the given ID |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::create_product_category() |
Create a new product category. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::edit_product_category() |
Edit a product category. |
includes/legacy/api/v3/class-wc-api-products.php: WC_API_Products::delete_product_category() |
Delete a product category. |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::create_product() |
Create a new product |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::validate_request() |
Validate the request by checking: |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::create_customer() |
Create a customer |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::edit_customer() |
Edit a customer |
includes/legacy/api/v2/class-wc-api-customers.php: WC_API_Customers::get_customers_count() |
Get the total number of customers |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::get_orders_count() |
Get the total number of orders |
includes/legacy/api/v2/class-wc-api-orders.php: WC_API_Orders::edit_order() |
Edit an order |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::get_coupon() |
Get the coupon for the given ID |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::get_coupons_count() |
Get the total number of coupons |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::get_coupon_by_code() |
Get the coupon for the given code |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::edit_coupon() |
Edit a coupon |
includes/legacy/api/v2/class-wc-api-coupons.php: WC_API_Coupons::create_coupon() |
Create a coupon |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::get_products_count() |
Get the total number of products |
includes/legacy/api/v2/class-wc-api-products.php: WC_API_Products::edit_product() |
Edit a product |