WC_Post_Data::do_deferred_product_syncpublic staticWC 1.0

Sync products queued to sync.

Method of the class: WC_Post_Data{}

No Hooks.

Returns

void. Nothing (null).

Usage

$result = WC_Post_Data::do_deferred_product_sync();

WC_Post_Data::do_deferred_product_sync() code WC 11.0.1

public static function do_deferred_product_sync() {
	global $wc_deferred_product_sync;

	// Syncing a product may defer more products (e.g. from hooks fired while saving it),
	// so the queue is drained in rounds, syncing each product at most once.
	$processed = array();
	while ( ! empty( $wc_deferred_product_sync ) ) {
		$product_ids              = array_diff( wp_parse_id_list( $wc_deferred_product_sync ), $processed );
		$wc_deferred_product_sync = array();

		foreach ( $product_ids as $product_id ) {
			self::deferred_product_sync( $product_id );
		}

		$processed = array_merge( $processed, $product_ids );
	}
}