Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Introduce 2 new hooks in Customer Update Route (#5345)
Browse files Browse the repository at this point in the history
* Introduce woocommerce_blocks_cart_update_customer_from_request hook

* Introduce woocommerce_blocks_cart_update_order_from_customer_request

* Test actions fire

* Update hook docs
  • Loading branch information
mikejolley authored Dec 13, 2021
1 parent 8ac18b6 commit cda1bae
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 111 deletions.
231 changes: 229 additions & 2 deletions bin/hook-docs/data/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,54 @@
"long_description_html": "<p>This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but WooCommerce core add to cart events trigger the same hook.</p>"
}
},
{
"name": "woocommerce_after_main_content",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_after_main_content.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_after_main_content",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Woocommerce_after_main_content hook.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_after_shop_loop",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_after_shop_loop.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_pagination - 10"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_applied_coupon",
"file": "StoreApi/Utilities/CartController.php",
Expand All @@ -81,9 +129,97 @@
"long_description_html": ""
}
},
{
"name": "woocommerce_archive_description",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_archive_description.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_taxonomy_archive_description - 10"
},
{
"name": "hooked",
"content": "woocommerce_product_archive_description - 10"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_before_main_content",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Woocommerce_before_main_content hook.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)"
},
{
"name": "hooked",
"content": "woocommerce_breadcrumb - 20"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_before_main_content",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_before_main_content.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)"
},
{
"name": "hooked",
"content": "woocommerce_breadcrumb - 20"
},
{
"name": "hooked",
"content": "WC_Structured_Data::generate_website_data() - 30"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_before_shop_loop",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_before_shop_loop.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "woocommerce_output_all_notices - 10"
},
{
"name": "hooked",
"content": "woocommerce_result_count - 20"
},
{
"name": "hooked",
"content": "woocommerce_catalog_ordering - 30"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_cart_enqueue_data",
"file": "BlockTypes/Cart.php",
"file": "BlockTypes/MiniCart.php",
"type": "action",
"doc": {
"description": "Fires after cart block data is registered.",
Expand All @@ -94,7 +230,7 @@
},
{
"name": "woocommerce_blocks_cart_enqueue_data",
"file": "BlockTypes/MiniCart.php",
"file": "BlockTypes/Cart.php",
"type": "action",
"doc": {
"description": "Fires after cart block data is registered.",
Expand All @@ -103,6 +239,70 @@
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_cart_update_customer_from_request",
"file": "StoreApi/Routes/CartUpdateCustomer.php",
"type": "action",
"doc": {
"description": "Fires when the Checkout Block/Store API updates a customer from the API request data.",
"long_description": "",
"tags": [
{
"name": "param",
"content": "Customer object.",
"types": [
"\\WC_Customer"
],
"variable": "$customer"
},
{
"name": "param",
"content": "Full details about the request.",
"types": [
"\\WP_REST_Request"
],
"variable": "$request"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_cart_update_order_from_customer_request",
"file": "StoreApi/Routes/CartUpdateCustomer.php",
"type": "action",
"doc": {
"description": "Fires when the Checkout Block/Store API updates an existing draft order from customer data.",
"long_description": "",
"tags": [
{
"name": "param",
"content": "Order object.",
"types": [
"\\WC_Order"
],
"variable": "$draft_order"
},
{
"name": "param",
"content": "Customer object.",
"types": [
"\\WC_Customer"
],
"variable": "$customer"
},
{
"name": "param",
"content": "Full details about the request.",
"types": [
"\\WP_REST_Request"
],
"variable": "$request"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_checkout_enqueue_data",
"file": "BlockTypes/Checkout.php",
Expand Down Expand Up @@ -318,6 +518,22 @@
"long_description_html": "<p>This hook fires after customer accounts are created and passes the customer data.</p>"
}
},
{
"name": "woocommerce_no_products_found",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_no_products_found.",
"long_description": "",
"tags": [
{
"name": "hooked",
"content": "wc_no_products_found - 10"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_register_post",
"file": "Domain/Services/CreateAccount.php",
Expand Down Expand Up @@ -393,6 +609,17 @@
"long_description_html": ""
}
},
{
"name": "woocommerce_shop_loop",
"file": "BlockTypes/LegacyTemplate.php",
"type": "action",
"doc": {
"description": "Hook: woocommerce_shop_loop.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "wooocommerce_store_api_validate_add_to_cart",
"file": "StoreApi/Utilities/CartController.php",
Expand Down
11 changes: 11 additions & 0 deletions bin/hook-docs/data/filters.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,17 @@
"long_description_html": ""
}
},
{
"name": "woocommerce_show_page_title",
"file": "BlockTypes/LegacyTemplate.php",
"type": "filter",
"doc": {
"description": "",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_store_api_disable_nonce_check",
"file": "StoreApi/Routes/AbstractCartRoute.php",
Expand Down
Loading

0 comments on commit cda1bae

Please sign in to comment.