WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
класс не описан

Automattic\WooCommerce\Blocks\StoreApi\Schemas

CartExtensionsSchema{} WC 1.0

Class CartExtensionsSchema

Хуков нет.

Возвращает

null. Ничего.

Использование

$CartExtensionsSchema = new CartExtensionsSchema();
// use class methods

Методы

  1. get_item_response( $request = null )
  2. get_properties()

Код CartExtensionsSchema{} WC 5.7.1

class CartExtensionsSchema extends AbstractSchema {
	/**
	 * The schema item name.
	 *
	 * @var string
	 */
	protected $title = 'cart-extensions';

	/**
	 * The schema item identifier.
	 *
	 * @var string
	 */
	const IDENTIFIER = 'cart-extensions';

	/**
	 * Cart extensions schema properties.
	 *
	 * @return array
	 */
	public function get_properties() {
		return [];
	}

	/**
	 * Handle the request and return a valid response for this endpoint.
	 *
	 * @param \WP_REST_Request $request Request containing data for the extension callback.
	 * @throws RouteException When callback is not callable or parameters are incorrect.
	 *
	 * @return array
	 */
	public function get_item_response( $request = null ) {
		try {
			$callback = $this->extend->get_update_callback( $request['namespace'] );
		} catch ( RouteException $e ) {
			throw $e;
		}
		if ( is_callable( $callback ) ) {
			$callback( $request['data'] );
		}
		return rest_ensure_response( wc()->api->get_endpoint_data( '/wc/store/cart' ) );
	}
}