diff --git a/includes/ProductSync/ProductValidator.php b/includes/ProductSync/ProductValidator.php index e2b6fdbb8..cb1ea67a8 100644 --- a/includes/ProductSync/ProductValidator.php +++ b/includes/ProductSync/ProductValidator.php @@ -182,6 +182,18 @@ protected function validate_product_stock_status() { */ protected function validate_product_visibility() { $product = $this->product_parent ? $this->product_parent : $this->product; + + /** + * Filters whether the product must be visible in catalog and search results to be validated. + * + * @since 2.6.5 + * + * @param boolean $enabled default true + * @param \WC_Product $product product object + */ + if ( ! apply_filters( 'wc_facebook_validate_product_visibility', true, $product ) ) { + return; + } if ( 'visible' !== $product->get_catalog_visibility() ) { throw new ProductExcludedException( __( 'Product is hidden from catalog and search.', 'facebook-for-woocommerce' ) );