-
Couldn't load subscription status.
- Fork 10
fix/SQUARE-190: Fix missing attribute names after Product Import #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
| $cursor = $response->get_data()->getCursor(); | ||
| if ( ! $cursor ) { | ||
| set_transient( 'wc_square_options_data', $options_data ); | ||
| set_transient( 'wc_square_options_data', $options_data, DAY_IN_SECONDS ); |
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.
Matched this with other instances of set_transient( 'wc_square_options_data', $options_data, DAY_IN_SECONDS );
32705f5 to
cd68f5a
Compare
cd68f5a to
2898fc2
Compare
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.
QA Update ✅
I have verified this PR in the SQUARE-190 branch, which has been fixed and is functioning as intended.
I tested the following on this branch:
- Created a variable product in Square with multiple attributes
- Synced the product to WooCommerce- worked correctly.
- Exported the Square catalog to a file.
- Cleared both Square and WooCommerce catalogs.
- Imported the exported catalog back into Square.
- Synced the product again to WooCommerce.
Result: Product Import/synced successfully.
Screen.Recording.2025-10-20.at.2.23.13.PM.mov
Testing Environment
- WordPress: 6.8.3
- Theme: Twenty Twenty-Five 1.3
- WooCommerce - 10.2.2
- PHP: 8.0.30
- Web Server: Nginx 1.20.2
- Browser: Chrome
- OS: macOS 15.2
- Branch: SQUARE-190
Steps to Test- As mentioned in the PR description.
Test Results - It is working as expected.
Functional Demo / Screencast -
Special Notes - Ready for UAT
Testing Document status:
Cases related to this Issue/PR are added to the Critical Flow Wiki pages:
- Yes
- Not Required/Applicable for this PR
Regression / Smoke Test Report ✅Tested with the Testing Environment
Next Step- Ready to Merge 🚀 cc @vikrampm1 |
All Submissions:
Changes proposed in this Pull Request:
Note: This bug is only reproducible in production
In
trunk, option metadata from Square was cached in thewc_square_options_datatransient. Some Square responses lackeditem_option_data.namewhen we first fetched them, so those transient entries stored an empty string for name. Becauseretrieve_options_data()short-circuited whenever the transient existed, later imports kept reusing those incomplete records and never refreshed them. As a result, WooCommerce products imported with attribute values but without attribute labels.The fix updates
retrieve_options_data()so that it treats any cached option missing a name as stale. When it finds an entry like that, it deletes the transient, pulls fresh option data from Square, and rebuilds the cache usingget_item_option_name_from_catalog_object(), which falls back to display_name if the primary name is empty. Whenever the importer refreshes these option details, it now stores the result with a TTL, ensuring subsequent imports reuse complete labels instead of blanks.Closes https://linear.app/a8c/issue/SQUARE-190/square-exportimport-process-loses-attribute-names
Steps to test the changes in this Pull Request:
Please follow the instructions from the Linear ticket.
Changelog entry