NotPurchasableException
extends StockAvailabilityException
in package
NotPurchasableException class.
This exception is thrown when an item in the cart is not able to be purchased.
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
$additional_data
Additional error data.
public
array<string|int, mixed>
$additional_data
= []
$error_code
Sanitized error code.
public
string
$error_code
$product_name
The name of the product that can only be purchased individually.
public
string
$product_name
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 —getAdditionalData()
Returns additional error data.
public
getAdditionalData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getErrorCode()
Returns the error code.
public
getErrorCode() : string
Return values
string —getProductName()
Returns the product name.
public
getProductName() : string