woocommerce/plugins/woocommerce-blocks/bin/hook-docs/data/actions.json

465 lines
22 KiB
JSON
Raw Normal View History

{
"$schema": "https://raw.githubusercontent.com/johnbillion/wp-hooks-generator/0.6.1/schema.json",
"hooks": [
{
"name": "__experimental_woocommerce_blocks_checkout_order_processed",
"file": "StoreApi/Routes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires before an order is processed by the Checkout Block/Store API.",
"long_description": "This hook informs extensions that $order has completed processing and is ready for payment.\n This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
"tags": [
{
"name": "see",
"content": "",
"refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3238"
},
{
"name": "example",
"content": "docs/examples/checkout-order-processed.md"
},
{
"name": "internal",
"content": "This Hook is experimental and may change or be removed."
},
{
"name": "param",
"content": "Order object.",
"types": [
"\\WC_Order"
],
"variable": "$order"
}
],
"long_description_html": "<p>This hook informs extensions that $order has completed processing and is ready for payment.</p> <p>This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action:</p> <ul> <li>To keep the interface focused (only pass $order, not passing request data).</li> <li>This also explicitly indicates these orders are from checkout block/StoreAPI.</li> </ul>"
}
},
{
"name": "__experimental_woocommerce_blocks_checkout_update_order_from_request",
"file": "StoreApi/Routes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires when the Checkout Block/Store API updates an order's from the API request data.",
"long_description": "This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendRestAPI class to post custom data and then process it.",
"tags": [
{
"name": "internal",
"content": "This Hook is experimental and may change or be removed."
},
{
"name": "param",
"content": "Order object.",
"types": [
"\\WC_Order"
],
"variable": "$order"
},
{
"name": "param",
"content": "Full details about the request.",
"types": [
"\\WP_REST_Request"
],
"variable": "$request"
}
],
"long_description_html": "<p>This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendRestAPI class to post custom data and then process it.</p>"
}
},
{
"name": "__experimental_woocommerce_blocks_checkout_update_order_meta",
"file": "StoreApi/Routes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires when the Checkout Block/Store API updates an order's meta data.",
"long_description": "This hook gives extensions the chance to add or update meta data on the $order.\n This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
"tags": [
{
"name": "see",
"content": "",
"refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3686"
},
{
"name": "internal",
"content": "This Hook is experimental and may change or be removed."
},
{
"name": "param",
"content": "Order object.",
"types": [
"\\WC_Order"
],
"variable": "$order"
}
],
"long_description_html": "<p>This hook gives extensions the chance to add or update meta data on the $order.</p> <p>This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action:</p> <ul> <li>To keep the interface focused (only pass $order, not passing request data).</li> <li>This also explicitly indicates these orders are from checkout block/StoreAPI.</li> </ul>"
}
},
{
"name": "woocommerce_add_to_cart",
"file": "StoreApi/Utilities/CartController.php",
"type": "action",
"doc": {
"description": "Fires when an item is added to the cart.",
"long_description": "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.",
"tags": [
{
"name": "param",
"content": "ID of the item in the cart.",
"types": [
"string"
],
"variable": "$cart_id"
},
{
"name": "param",
"content": "ID of the product added to the cart.",
"types": [
"integer"
],
"variable": "$product_id"
},
{
"name": "param",
"content": "Quantity of the item added to the cart.",
"types": [
"integer"
],
"variable": "$quantity"
},
{
"name": "param",
"content": "Variation ID of the product added to the cart.",
"types": [
"integer"
],
"variable": "$variation_id"
},
{
"name": "param",
"content": "Array of variation data.",
"types": [
"array"
],
"variable": "$variation"
},
{
"name": "param",
"content": "Array of other cart item data.",
"types": [
"array"
],
"variable": "$cart_item_data"
}
],
"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_applied_coupon",
"file": "StoreApi/Utilities/CartController.php",
"type": "action",
"doc": {
"description": "Fires after a coupon has been applied to the cart.",
"long_description": "",
"tags": [
{
"name": "param",
"content": "The coupon code that was applied.",
"types": [
"string"
],
"variable": "$coupon_code"
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_cart_enqueue_data",
"file": "BlockTypes/Cart.php",
"type": "action",
"doc": {
"description": "Fires after cart block data is registered.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_cart_enqueue_data",
"file": "BlockTypes/MiniCart.php",
"type": "action",
"doc": {
"description": "Fires after cart block data is registered.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_checkout_enqueue_data",
"file": "BlockTypes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires after checkout block data is registered.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_enqueue_cart_block_scripts_after",
"file": "BlockTypes/Cart.php",
"type": "action",
"doc": {
"description": "Fires after cart block scripts are enqueued.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_enqueue_cart_block_scripts_before",
"file": "BlockTypes/Cart.php",
"type": "action",
"doc": {
"description": "Fires before cart block scripts are enqueued.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_enqueue_checkout_block_scripts_after",
"file": "BlockTypes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires after checkout block scripts are enqueued.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_enqueue_checkout_block_scripts_before",
"file": "BlockTypes/Checkout.php",
"type": "action",
"doc": {
"description": "Fires before checkout block scripts are enqueued.",
"long_description": "",
"tags": [],
"long_description_html": ""
}
},
{
"name": "woocommerce_blocks_loaded",
"file": "Domain/Bootstrap.php",
"type": "action",
"doc": {
"description": "Fires after WooCommerce Blocks plugin has loaded.",
"long_description": "This hook is intended to be used as a safe event hook for when the plugin has been loaded, and all dependency requirements have been met.",
"tags": [],
"long_description_html": "<p>This hook is intended to be used as a safe event hook for when the plugin has been loaded, and all dependency requirements have been met.</p>"
}
},
{
"name": "woocommerce_blocks_{$this->registry_identifier}_registration",
"file": "Integrations/IntegrationRegistry.php",
"type": "action",
"doc": {
"description": "Fires when the IntegrationRegistry is initialized.",
"long_description": "Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.",
"tags": [
{
"name": "param",
"content": "Instance of the IntegrationRegistry class which exposes the IntegrationRegistry::register() method.",
"types": [
"\\Automattic\\WooCommerce\\Blocks\\Integrations\\IntegrationRegistry"
],
"variable": "$this"
}
],
"long_description_html": "<p>Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.</p>"
}
},
{
"name": "woocommerce_check_cart_items",
"file": "StoreApi/Utilities/CartController.php",
"type": "action",
"doc": {
"description": "Fires when cart items are being validated.",
"long_description": "Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.",
"tags": [],
"long_description_html": "<p>Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.</p>"
}
},
{
"name": "woocommerce_created_customer",
"file": "Domain/Services/CreateAccount.php",
"type": "action",
"doc": {
"description": "Fires after a customer account has been registered.",
"long_description": "This hook fires after customer accounts are created and passes the customer data.",
"tags": [
{
"name": "param",
"content": "New customer (user) ID.",
"types": [
"integer"
],
"variable": "$customer_id"
},
{
"name": "param",
"content": "Array of customer (user) data.",
"types": [
"array"
],
"variable": "$new_customer_data"
},
{
"name": "param",
"content": "The generated password for the account.",
"types": [
"string"
],
"variable": "$password_generated"
}
],
"long_description_html": "<p>This hook fires after customer accounts are created and passes the customer data.</p>"
}
},
{
"name": "woocommerce_register_post",
"file": "Domain/Services/CreateAccount.php",
"type": "action",
"doc": {
"description": "Fires before a customer account is registered.",
"long_description": "This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.\n This could be used to add extra validation logic and append errors to the array.",
"tags": [
{
"name": "param",
"content": "Customer username.",
"types": [
"string"
],
"variable": "$username"
},
{
"name": "param",
"content": "Customer email address.",
"types": [
"string"
],
"variable": "$user_email"
},
{
"name": "param",
"content": "Error object.",
"types": [
"\\WP_Error"
],
"variable": "$errors"
}
],
"long_description_html": "<p>This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.</p> <p>This could be used to add extra validation logic and append errors to the array.</p>"
}
},
{
"name": "woocommerce_rest_checkout_process_payment_with_context",
"file": "StoreApi/Routes/Checkout.php",
"type": "action_reference",
"doc": {
"description": "Process payment with context.",
"long_description": "",
"tags": [
{
"name": "hook",
"content": "woocommerce_rest_checkout_process_payment_with_context"
},
{
"name": "throws",
"content": "If there is an error taking payment, an \\Exception object can be thrown with an error message.",
"types": [
"\\Exception"
]
},
{
"name": "param",
"content": "Holds context for the payment, including order ID and payment method.",
"types": [
"\\Automattic\\WooCommerce\\Blocks\\Payments\\PaymentContext"
],
"variable": "$context"
},
{
"name": "param",
"content": "Result object for the transaction.",
"types": [
"\\Automattic\\WooCommerce\\Blocks\\Payments\\PaymentResult"
],
"variable": "$payment_result"
}
],
"long_description_html": ""
}
},
{
"name": "wooocommerce_store_api_validate_add_to_cart",
"file": "StoreApi/Utilities/CartController.php",
"type": "action",
"doc": {
"description": "Fires during validation when adding an item to the cart via the Store API.",
"long_description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.",
"tags": [
{
"name": "param",
"content": "Product object being added to the cart.",
"types": [
"\\WC_Product"
],
"variable": "$product"
},
{
"name": "param",
"content": "Add to cart request params including id, quantity, and variation attributes.",
"types": [
"array"
],
"variable": "$request"
}
],
"long_description_html": "<p>Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.</p>"
}
},
{
"name": "wooocommerce_store_api_validate_cart_item",
"file": "StoreApi/Utilities/CartController.php",
"type": "action",
"doc": {
"description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from occurring.",
"long_description": "",
"tags": [
{
"name": "param",
"content": "Product object being added to the cart.",
"types": [
"\\WC_Product"
],
"variable": "$product"
},
{
"name": "param",
"content": "Cart item array.",
"types": [
"array"
],
"variable": "$cart_item"
}
],
"long_description_html": ""
}
}
]
}