This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Store API: Consistent error code and hook naming #5992
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mikejolley
added
focus: rest api
Work impacting REST api routes.
type: refactor
The issue/PR is related to refactoring.
labels
Mar 3, 2022
rubikuserbot
requested review from
a team and
nielslange
and removed request for
a team
March 3, 2022 16:08
Size Change: +2 B (0%) Total Size: 863 kB
ℹ️ View Unchanged
|
mikejolley
force-pushed
the
update/error-code-and-hook-naming
branch
from
March 4, 2022 13:40
a763555
to
e254de4
Compare
nielslange
approved these changes
Mar 7, 2022
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.
LGTM 🚢
Merged
5 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
focus: rest api
Work impacting REST api routes.
type: refactor
The issue/PR is related to refactoring.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a PR for hook name and error code consistency across the Store API codebase. I've updated docs + usage, and deprecated the previous names inline.
woocommerce_rest_
. This is inline with the majority of existing error codes, but there were a few with either no prefix, orblocks
prefix. Additionally, codes should use underscores rather than hyphens to separate words.@internal
documentation to state this. For new Store API hooks, they should have thewoocommerce_store_api_
prefix. Newer hooks are doing this, but we had some older ones usingwoocommerce_blocks_
. I've deprecated these.We also had some instances where we had different codes for the same type of error in the cart controller, so I cleared this up also.
Fixes #5980
Testing
Nothing should be user facing however, placing an order via Block checkout should be smoke tested, as well as one of the extensions consuming the deprecated hooks such as pre-orders (https://github.com/woocommerce/woocommerce-pre-orders/blob/bd1169c93ed3ccd8c2f33f3a54b244aefe63b0c2/includes/class-wc-pre-orders-checkout.php#L39 or subscriptions (https://github.com/woocommerce/woocommerce-subscriptions/blob/0704f35c00ea6df2821b9c1592b77205a96e2937/includes/early-renewal/class-wcs-cart-early-renewal.php#L34-L38)
Changelog