Automattic\WooCommerce\StoreApi\Utilities
CartController::throw_default_product_exception()
Default exception thrown when an item cannot be added to the cart.
Method of the class: CartController{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->throw_default_product_exception( $product );
- $product(\WC_Product) (required)
- Product object associated with the cart item.
CartController::throw_default_product_exception() CartController::throw default product exception code WC 8.6.1
protected function throw_default_product_exception( \WC_Product $product ) { throw new RouteException( 'woocommerce_rest_product_not_purchasable', sprintf( /* translators: %s: product name */ __( '"%s" is not available for purchase.', 'woocommerce' ), $product->get_name() ), 400 ); }