feat: enforce 21 image limit for Facebook catalog sync #3555
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.
Description
This PR implements a 21 image limit for the Facebook catalog multiple images functionality with robust validation to prevent sync issues and align with Facebook's catalog requirements. The implementation includes both client-side and server-side validation with improved user experience.
Key Changes:
MAX_FACEBOOK_IMAGES
constant (21) for easy maintenanceProblem Solved:
Previously, users could select unlimited images when using the "Use multiple images" option for product variations, which could cause Facebook catalog sync issues. The initial implementation also had an infinite loop bug that would freeze the UI with repeated alerts.
Dependencies: None - uses existing WordPress media library APIs and WooCommerce hooks.
Type of change
Checklist
Changelog entry
Enforce 21 image limit for Facebook catalog multiple images with improved validation and user experience
Test Plan
Automated Testing
npm run test:js
andvendor/bin/phpunit
both pass successfullyManual Testing Steps
Test Real-time Validation
Test Infinite Loop Prevention
Test Server-side Backup Validation
Test Backward Compatibility
Test Configuration
Screenshots