-
Notifications
You must be signed in to change notification settings - Fork 219
Introduce 2 new hooks in Customer Update Route #5345
Conversation
Size Change: -23.6 kB (-3%) Total Size: 817 kB
ℹ️ View Unchanged
|
Is there any documentation we should update with these new hooks? Also is there a way to test that these fire correctly? Code looks good, although with a caveat that I haven't done any PHP for 10 years! |
@alexflorisca I've added unit tests to confirm the hooks run, and updated hook docs ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, but there seem to be a bunch of duplicated entries and a lot of changes made to the docs unrelated to the 2 hooks you added here. Can you just have a scan through and double check that everything is good doc wise, and if you're happy, I'm happy to approve.
} | ||
}, | ||
{ | ||
"name": "woocommerce_after_main_content", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplicate of the above. It's also unrelated to the hooks you added in this PR. Is this something that exists but was missing from the docs?
} | ||
}, | ||
{ | ||
"name": "woocommerce_before_main_content", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again this seems to be the same as the one above, with a minor difference in the description and an extra tag. Just checking this is intended?
{ | ||
"name": "woocommerce_blocks_cart_enqueue_data", | ||
"file": "BlockTypes/Cart.php", | ||
"file": "BlockTypes/MiniCart.php", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has the Cart and MiniCart swapped round here and on the action below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in slack (p1639399554056600-slack-C8X6Q7XQU) and decided to ignore the duplicated actions for now (bug reported in #5374)
* Introduce woocommerce_blocks_cart_update_customer_from_request hook * Introduce woocommerce_blocks_cart_update_order_from_customer_request * Test actions fire * Update hook docs
* Introduce woocommerce_blocks_cart_update_customer_from_request hook * Introduce woocommerce_blocks_cart_update_order_from_customer_request * Test actions fire * Update hook docs
Adds 2 new action hooks to allow vendors to edit order/customer data when customers are updated via the API.
woocommerce_blocks_cart_update_customer_from_request
\WC_Customer $customer
,\WP_REST_Request $request
woocommerce_blocks_cart_update_order_from_customer_request
\WC_Order $draft_order
,\WC_Customer $customer
,\WP_REST_Request $request
Fixes #5202
Testing
No user facing tests. Unit test coverage added to confirm hooks fire.
Changelog