WooCommerce Code Reference

OutOfStockException extends StockAvailabilityException
in package

OutOfStockException class.

This exception is thrown when an item in a draft order is out of stock completely.

Table of Contents

$additional_data  : array<string|int, mixed>
Additional error data.
$error_code  : string
Sanitized error code.
$product_name  : string
The name of the product that can only be purchased individually.
__construct()  : mixed
Setup exception.
getAdditionalData()  : array<string|int, mixed>
Returns additional error data.
getErrorCode()  : string
Returns the error code.
getProductName()  : string
Returns the product name.

Properties

Methods

__construct()

Setup exception.

public __construct(string $error_code, string $product_name[, array<string|int, mixed> $additional_data = [] ]) : mixed
Parameters
$error_code : string

Machine-readable error code, e.g woocommerce_invalid_product_id.

$product_name : string

The name of the product that can only be purchased individually.

$additional_data : array<string|int, mixed> = []

Extra data (key value pairs) to expose in the error response.

Return values
mixed