WordPress at a glance
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

CartController::throw_default_product_exception() protected WC 1.0

Default exception thrown when an item cannot be added to the cart.

{} It's a method of the class: CartController{}

No Hooks.

Return

Null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->throw_default_product_exception( \WC_Product $product );
\WC_Product $product (required)
-

Code of CartController::throw_default_product_exception() WC 5.0.0

<?php
protected function throw_default_product_exception( \WC_Product $product ) {
	throw new RouteException(
		'woocommerce_rest_cart_product_is_not_purchasable',
		sprintf(
			/* translators: %s: product name */
			__( '&quot;%s&quot; is not available for purchase.', 'woocommerce' ),
			$product->get_name()
		),
		400
	);
}