From 3a429fee76b2055b635a76df1f752e8d7ea84cde Mon Sep 17 00:00:00 2001 From: Marian Shymon Date: Sun, 18 May 2025 13:38:03 +0100 Subject: [PATCH] Implemented the banner. --- includes/Admin/Product_Sets.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/includes/Admin/Product_Sets.php b/includes/Admin/Product_Sets.php index e829d26f2..65cb1a000 100644 --- a/includes/Admin/Product_Sets.php +++ b/includes/Admin/Product_Sets.php @@ -13,6 +13,7 @@ defined( 'ABSPATH' ) || exit; use WP_Term; +use WooCommerce\Facebook\RolloutSwitches; /** * General handler for the product set admin functionality. @@ -65,8 +66,30 @@ public function __construct() { // save custom field data add_action( 'created_fb_product_set', array( $this, 'save_custom_field' ), 10, 2 ); add_action( 'edited_fb_product_set', array( $this, 'save_custom_field' ), 10, 2 ); + // show a banner about chnages to product sets sync + add_action( 'admin_notices', array( $this, 'display_fb_product_sets_banner' ) ); } + public function display_fb_product_sets_banner() { + if ( isset( $_GET['taxonomy'] ) && 'fb_product_set' === $_GET['taxonomy'] ) { + $is_product_sets_sync_enbaled = facebook_for_woocommerce()->get_rollout_switches()->is_switch_enabled( + RolloutSwitches::SWITCH_PRODUCT_SETS_SYNC_ENABLED + ); + if ( $is_product_sets_sync_enbaled ) { + $fb_catalog_id = facebook_for_woocommerce()->get_integration()->get_product_catalog_id(); + + ?> +
+

Your categories now automatically sync as product sets on Facebook

+

To make changes to automatically synced sets going forward, you should edit your categories on WooCommerce. This may take some time to update initially, but then will automatically sync every few minutes. There are no changes to any sets you previously created. + To see what’s synced, go to sets in Commerce Manager.

+
+