Abstract Cart Route

Description Description

Source Source

File: packages/woocommerce-blocks/src/StoreApi/Routes/AbstractCartRoute.php

Top ↑

Methods Methods

  • __construct — Constructor accepts two types of schema; one for the item being returned, and one for the cart as a whole. These may be the same depending on the route.
  • add_nonce_headers — Add nonce headers to a response object.
  • calculate_totals — Ensures the cart totals are calculated before an API response is generated.
  • check_nonce — For non-GET endpoints, require and validate a nonce to prevent CSRF attacks.
  • get_response — Get the route response based on the type of request.
  • get_route_error_response — Get route response when something went wrong.
  • maybe_release_stock — If there is a draft order, releases stock.
  • requires_nonce — Checks if a nonce is required for the route.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.