Skip to content
Merged
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
21 changes: 21 additions & 0 deletions packages/sync/src/modules/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function __construct() {
add_filter( 'jetpack_sync_before_enqueue_woocommerce_new_order_item', array( $this, 'filter_order_item' ) );
add_filter( 'jetpack_sync_before_enqueue_woocommerce_update_order_item', array( $this, 'filter_order_item' ) );
add_filter( 'jetpack_sync_whitelisted_comment_types', array( $this, 'add_review_comment_types' ) );

// Blacklist Action Scheduler comment types.
add_filter( 'jetpack_sync_prevent_sending_comment_data', array( $this, 'filter_action_scheduler_comments' ), 10, 2 );
}

/**
Expand Down Expand Up @@ -326,6 +329,24 @@ public function add_review_comment_types( $comment_types ) {
return $comment_types;
}

/**
* Stop comments from the Action Scheduler from being synced.
* https://github.com/woocommerce/woocommerce/tree/e7762627c37ec1f7590e6cac4218ba0c6a20024d/includes/libraries/action-scheduler
*
* @since 7.7.0
*
* @param boolean $can_sync Should we prevent comment data from bing synced to WordPress.com.
* @param mixed $comment WP_COMMENT object.
*
* @return bool
*/
public function filter_action_scheduler_comments( $can_sync, $comment ) {
if ( isset( $comment->comment_agent ) && 'ActionScheduler' === $comment->comment_agent ) {
return true;
}
return $can_sync;
}

/**
* Whitelist for options we are interested to sync.
*
Expand Down