-
Notifications
You must be signed in to change notification settings - Fork 10
Sync Only the Utilized Option Values #404
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
if ( ! isset( $used_option_values[ $attribute_name ] ) ) { | ||
$used_option_values[ $attribute_name ] = array(); | ||
} | ||
$used_option_values[ $attribute_name ][] = $attribute['option']; |
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.
Same question as above. If for some reason this isn't already an array, this will cause an error. May want an is_array
check in the above conditional?
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.
I think the code $used_option_values[ $attribute_name ]
will always be an array, since we initialize it as one on line 827.
Co-authored-by: Darin Kotter <[email protected]>
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 fix/SQUARE-159
branch, which has been fixed and is functioning as intended.
I tested the following on this branch:
- Imported the product into WooCommerce using “Import all Products from Square.”
- Verified the imported product appears correctly in WooCommerce.
- Unused terms (Black, Red, Yellow, Pink) are not imported.
Before
Square Dashboard

After


Testing Environment
- WordPress: 6.8.2
- Theme: Storefront 4.6.1
- Theme: Twenty Twenty-Five 1.3
- WooCommerce - 10.2.0
- PHP: 8.0.30
- Web Server: Nginx 1.20.2
- Browser: Chrome
- OS: macOS 15.2
- Branch: fix/SQUARE-159
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
All Submissions:
Changes proposed in this Pull Request:
This PR fixes an issue where Square product imports were creating unnecessary attribute terms in WooCommerce. Previously, when importing products from Square, the plugin would import ALL possible option values from Square's Option Name, even if the specific product didn't use all of those values.
extract_attributes_from_square_options()
method to accept variations dataCloses https://linear.app/a8c/issue/SQUARE-159/general-product-options-being-synced-to-woo.
Steps to test the changes in this Pull Request:
Create Square Product with Partial Option Usage:
Import Product to WooCommerce:
Verify Attribute Terms:
Changelog entry