registered || ! function_exists( 'woocommerce_store_api_register_endpoint_data' ) ) { return; } woocommerce_store_api_register_endpoint_data( [ 'endpoint' => CartSchema::IDENTIFIER, 'namespace' => 'ips-order-cart', 'data_callback' => [ $this, 'data' ], 'schema_callback' => [ $this, 'schema' ], 'schema_type' => ARRAY_A, ] ); $this->registered = true; } public function data(): array { return [ 'pickup' => LocalPickupResolver::build_checkout_payload() ]; } public function schema(): array { return [ 'pickup' => [ 'description' => 'Current IPS pickup locations and selection for this cart.', 'type' => 'object', 'context' => [ 'view', 'edit' ], 'readonly' => true, 'properties' => [ 'available' => [ 'type' => 'boolean' ], 'selectedLocationId' => [ 'type' => 'integer' ], 'selectionInvalid' => [ 'type' => 'boolean' ], 'locations' => [ 'type' => 'array', 'items' => [ 'type' => 'object' ] ], ], ] ]; } }