Submit
Path:
~
/
home
/
getwphos
/
public_html
/
almajd14
/
wp-content
/
plugins
/
woocommerce
/
src
/
StoreApi
/
Schemas
/
V1
/
File Content:
CartExtensionsSchema.php
<?php namespace Automattic\WooCommerce\StoreApi\Schemas\V1; use Automattic\WooCommerce\StoreApi\Exceptions\RouteException; use Automattic\WooCommerce\StoreApi\SchemaController; use Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema; use Automattic\WooCommerce\StoreApi\Utilities\CartController; /** * Class CartExtensionsSchema */ 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 schema instance. * * @var CartSchema */ public $cart_schema; /** * Constructor. * * @param ExtendSchema $extend Rest Extending instance. * @param SchemaController $controller Schema Controller instance. */ public function __construct( ExtendSchema $extend, SchemaController $controller ) { parent::__construct( $extend, $controller ); $this->cart_schema = $this->controller->get( CartSchema::IDENTIFIER ); } /** * 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 ( \Exception $e ) { throw new RouteException( 'woocommerce_rest_cart_extensions_error', esc_html( $e->getMessage() ), 400 ); } // Run the callback. Exceptions are not caught here. $callback( $request['data'] ); try { // We recalculate the cart if we had something to run. $controller = new CartController(); $cart = $controller->calculate_totals(); $response = $this->cart_schema->get_item_response( $cart ); return rest_ensure_response( $response ); } catch ( \Exception $e ) { throw new RouteException( 'woocommerce_rest_cart_extensions_error', esc_html( $e->getMessage() ), 400 ); } } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
AI
---
0755
AbstractAddressSchema.php
10838 bytes
0644
AbstractSchema.php
13143 bytes
0644
BatchSchema.php
427 bytes
0644
BillingAddressSchema.php
4569 bytes
0644
CartCouponSchema.php
3047 bytes
0644
CartExtensionsSchema.php
2259 bytes
0644
CartFeeSchema.php
2169 bytes
0644
CartItemSchema.php
7739 bytes
0644
CartSchema.php
16203 bytes
0644
CartShippingRateSchema.php
11642 bytes
0644
CheckoutOrderSchema.php
752 bytes
0644
CheckoutSchema.php
15407 bytes
0644
ErrorSchema.php
1151 bytes
0644
ImageAttachmentSchema.php
2616 bytes
0644
ItemSchema.php
11538 bytes
0644
OrderCouponSchema.php
2468 bytes
0644
OrderFeeSchema.php
2253 bytes
0644
OrderItemSchema.php
2853 bytes
0644
OrderSchema.php
13047 bytes
0644
PatternsSchema.php
673 bytes
0644
ProductAttributeSchema.php
2555 bytes
0644
ProductBrandSchema.php
3575 bytes
0644
ProductCategorySchema.php
3579 bytes
0644
ProductCollectionDataSchema.php
5066 bytes
0644
ProductReviewSchema.php
6269 bytes
0644
ProductSchema.php
33579 bytes
0644
ShippingAddressSchema.php
2906 bytes
0644
TermSchema.php
2205 bytes
0644
N4ST4R_ID | Naxtarrr