Fix: Clear stale Square category ID from all associated WooCommerce categories#473
Draft
faisal-alvi wants to merge 3 commits intotrunkfrom
Draft
Fix: Clear stale Square category ID from all associated WooCommerce categories#473faisal-alvi wants to merge 3 commits intotrunkfrom
faisal-alvi wants to merge 3 commits intotrunkfrom
Conversation
🔍 WordPress Plugin Check Report
📊 Report
❌ Errors (8)📁 includes/Framework/PaymentGateway/Admin/views/html-admin-gateway-status.php (1 error)
📁 includes/Framework/PaymentGateway/Admin/views/html-user-profile-section.php (1 error)
📁 includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor.php (1 error)
📁 includes/Framework/PaymentGateway/Admin/views/html-user-profile-field-customer-id.php (1 error)
📁 includes/Framework/PaymentGateway/Admin/views/html-order-partial-capture.php (1 error)
📁 includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor-token.php (1 error)
📁 includes/WC_Payments_Compatibility.php (1 error)
📁 includes/Admin/Product_Editor_Compatibility.php (1 error)
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Collaborator
Author
|
@iamdharmesh Could you give this a code review when you get a chance? |
iamdharmesh
approved these changes
Apr 7, 2026
Collaborator
iamdharmesh
left a comment
There was a problem hiding this comment.
Thanks @faisal-alvi. Code looks good.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All Submissions:
Changes proposed in this Pull Request:
When multiple WooCommerce product categories were mapped to the same Square category ID and that Square category was deleted or missing,
refresh_category_mappings()only cleared the stale mapping for one WC category. The rest kept the invalid Square ID, causing manual sync to fail atupsert_categories().This change:
square_versionin the map for every associated WC category.Note
The plugin does not intentionally allow multiple WC categories per Square ID; this can occur when two WC categories share the same name and are matched to the same Square category across syncs, or from manual/DB edits. The fix makes cleanup resilient to that state.
Closes https://linear.app/a8c/issue/SQUARE-261/stale-category-mapping-not-fully-cleaned-up-when-two-woocommerce.
Steps to test the changes in this Pull Request:
wc_square_category_mapoption so two WC category IDs point to the samesquare_id.Changelog entry
Fix - Stale category mapping not fully cleaned when two WooCommerce categories share the same Square category ID; all associated WC categories are now unmapped and sync continues.