Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions includes/Admin/Product_Sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
defined( 'ABSPATH' ) || exit;

use WP_Term;
use WooCommerce\Facebook\RolloutSwitches;

/**
* General handler for the product set admin functionality.
Expand Down Expand Up @@ -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();

?>
<div class="notice notice-info">
<p><b>Your categories now automatically sync as product sets on Facebook</b></p>
<p>To make changes to automatically synced sets going forward, you should <a href="edit-tags.php?taxonomy=product_cat" target="_blank">edit your categories on WooCommerce</a>. 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 <a href="https://business.facebook.com/commerce/catalogs/<?php echo esc_attr( $fb_catalog_id ); ?>/sets" target="_blank">sets in Commerce Manager</a>.</p>
</div>
<?php
}
}
}



/**
* Add field to Facebook Product Set new term
Expand Down