ClassesBigCommerceProxyAmp Cart Controller

AMP_Cart_Controller

AMP_Cart_Controller class

Methods

register_routes

Init endpoint.

public register_routes(): void

get_items

Returns cart data.

public get_items(\WP_REST_Request $request): \WP_REST_Response|\WP_Error

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestRequest instance.

get_cart_totals

protected get_cart_totals(mixed $data): mixed

Parameters:

ParameterTypeDescription
$datamixed

Inherited methods

__construct

Proxy_Controller class constructor

public __construct(array $config): mixed

Parameters:

ParameterTypeDescription
$configarrayConfiguration details.

register_routes

Init Proxy endpoints.

public register_routes(): void

create_cart

Creates a new cart and returns the BigCommerce API response.

public create_cart(\WP_REST_Request $request): \WP_REST_Response

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestThe request instance.

create_redirect_url

Creates redirect URLs from a cart ID.

public create_redirect_url(\WP_REST_Request $request): \WP_REST_Response

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestRequest instance.

delete_cart

Deletes a cart.

public delete_cart(\WP_REST_Request $request): \WP_REST_Response

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestRequest instance.

update_cart_item

Updates or deletes a cart line item.

public update_cart_item(\WP_REST_Request $request): \WP_REST_Response

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestRequest instance.

add_cart_items

Add cart line items.

public add_cart_items(\WP_REST_Request $request): \WP_REST_Response

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestRequest instance.

get_request_headers

Provides request headers for use in multiple methods.

public get_request_headers(\WP_REST_Request $request, string $route): array

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestThe request instance.
$routestringThe BigCommerce request route.

Return Value:

A headers associative array.


get_items_permissions_check

Permission check for REST requests to the proxy endpoint.

public get_items_permissions_check(\WP_REST_Request $request): \WP_Error|true

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestREST request to check.

Return Value:

True if the request is allowed, or else an error.


get_items

Proxy requests.

public get_items(\WP_REST_Request $request): \WP_REST_Response|\WP_Error

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestProxied request.

route

Given a request, return the real URL.

public route(\WP_REST_Request $request): string

Parameters:

ParameterTypeDescription
$request\WP_REST_RequestThe request.


Automatically generated on 2025-01-21