woocommerce/plugins/woocommerce-blocks/docs
Christos Lilitsas c35bf8ee67 Store API: Refactored validation handling and introduced `woocommerce_store_api_cart_errors` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5904)
* Introduce 'wooocommerce_store_api_validate_cart' action

This action can be used by third party developers to add extra 'errors' in cart route responses. This is meant to function as a replacement of the legacy 'woocommerce_check_cart_items' hook.

* Introduce a new 'wooocommerce_blocks_draft_order_updated' action

The new action can be used to modify the finalized draft order object.
Additionally, developers can use it to throw a RouteException in order to prevent access to the checkout block.

The PR also shuffles some existing code that checks the order instance and sets the draft order ID before the 'woocommerce_blocks_checkout_update_order_meta' gets fired.

* Fix PHPCS

* Revert changes to Checkout route

* Add some extra content to the 'woocommerce_blocks_checkout_update_order_meta' docblock on the effect of exceptions thrown from callbacks

* Add __experimental prefix to 'wooocommerce_store_api_validate_cart' action

* Remove long ooo

* Add example

* Refactor cart error getters as wrappers to the validate functions

* Refactor stock_exceptions_to_wp_errors to return a single wp error.

* Add type hint in custom exception

* Fix namespace versioning and some minor improvements

* Move InvalidCartException catcher from AbstractCartRoute to AbstractRoute

* Introduce the __experimental_woocommerce_store_api_cart_errors filter

* Handle all notices and group them into a single WP_Error instance

* Cleanup doc and update example

* Cleanup NoticeHandler

* Fix doc

* Fix WP_Error namespace

* Update NoticeHandler unit tests

* Fix Unit tests typo

* Add docs to tests to bypass precommit scripts

* Refactor wp error grouping with merge_from

* Remove previous cart getters and refactor the get_cart_errors

* Fix CartSchema error getter and minor fixes

* Revert NoticeHandler exception namespace

* Unit test fix for get_cart_errors

* Switch back to do_action

* Update the example doc

* Duplicate use statement

* Update docblock in validate_cart() method for validation hooks

* Update action docs

* Remove __experimental prefix

Co-authored-by: Manos Psychogyiopoulos <psyx@somewherewarm.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-02 12:21:31 +00:00
..
block-client-apis Include issue submission link in the footer of all documention (.md files) (https://github.com/woocommerce/woocommerce-blocks/pull/5655) 2022-02-02 14:27:46 +00:00
blocks Include issue submission link in the footer of all documention (.md files) (https://github.com/woocommerce/woocommerce-blocks/pull/5655) 2022-02-02 14:27:46 +00:00
contributors Refactor ExtendRestApi as ExtendSchema and expose `register_endpoint_data` as a public function (https://github.com/woocommerce/woocommerce-blocks/pull/5941) 2022-03-01 10:34:05 +00:00
examples Store API: Refactored validation handling and introduced `woocommerce_store_api_cart_errors` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5904) 2022-03-02 12:21:31 +00:00
extensibility Store API: Refactored validation handling and introduced `woocommerce_store_api_cart_errors` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5904) 2022-03-02 12:21:31 +00:00
templates Full Store Editing: Technical documentation (https://github.com/woocommerce/woocommerce-blocks/pull/5939) 2022-03-02 08:57:53 +00:00
testing Release: 7.1.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5959) 2022-03-01 12:10:42 +01:00
theming Include issue submission link in the footer of all documention (.md files) (https://github.com/woocommerce/woocommerce-blocks/pull/5655) 2022-02-02 14:27:46 +00:00
readme.md Full Store Editing: Technical documentation (https://github.com/woocommerce/woocommerce-blocks/pull/5939) 2022-03-02 08:57:53 +00:00

readme.md

WooCommerce Blocks Handbook

The WooCommerce Blocks Handbook provides documentation for designers and developers on how to extend or contribute to blocks, and how internal developers should handle new releases.

Document Description
Contributing These documents explain how you can contribute to the development of the blocks plugin, development best practices, and how to help with testing.
Blocks This documentation covers functionality specific to certain Blocks.
Block Client APIs This documentation covers API interfaces within Blocks. In most cases, these docs describe APIs and interfaces that are internal only, and thus are provided to assist with developing the blocks in this repository. Documentation will tend to focus on high level overviews.
Store API (REST API) These documents cover the Store API used to get product data on the frontend.
Extensibility These documents cover extensibility of WooCommerce Blocks.
Theming These documents cover theming for blocks, styles, CSS classnames and other theming best practices.
Templates These documents provide a technical overview of WooCommerce block template (parts) functionality.

We're hiring! Come work with us!

🐞 Found a mistake, or have a suggestion? Leave feedback about this document here.