facebook-for-woocommerce
facebook-for-woocommerce copied to clipboard
Add filter for skipping validation of catalog visibility
Add filter "wc_facebook_validate_product_visibility" to optionally skip the validation of product visibility in catalog and search results.
- [x] Do the changed files pass
phpcs
checks? Please removephpcs:ignore
comments in changed files and fix any issues, or delete if not practical.
Changes proposed in this Pull Request:
Some plugins like "WooCommerce Single Variations" by IconicWP allow single variations to show up in the catalog. Therefore a common use case is to show a handful of variations in the catalog and hide the parent product from catalog and search results. This prevents the variable product altogether from syncing as the product is validated and part of this validation is whether the product is visible in catalog and search results.
As the hard criteria whether a product is included / synced is the post status and additional exclusion rules by taxonomy, the catalog visibility should be optional.
How to test the changes in this Pull Request:
- Exclude a product from catalog in product edit screen
- Sync to Facebook, see the product is not synced
- Add e.g.
add_filter('wc_facebook_validate_product_visibility', '__return_false', 10);
to functions.php - Sync to Facebook, confirm the product is synced again
Changelog entry
New - Add filter "wc_facebook_validate_product_visibility"