WC_Helper_Updater::transient_update_themes()public staticWC 1.0

Runs on pre_set_site_transient_update_themes, provides custom packages for WooCommerce.com-hosted extensions.

Метод класса: WC_Helper_Updater{}

Хуки из метода

Возвращает

Объект. The same or a modified version of the transient.

Использование

$result = WC_Helper_Updater::transient_update_themes( $transient );
$transient(объект) (обязательный)
The update_themes transient object.

Код WC_Helper_Updater::transient_update_themes() WC 9.4.2

public static function transient_update_themes( $transient ) {
	$update_data = self::get_update_data();

	foreach ( WC_Helper::get_local_woo_themes() as $theme ) {
		if ( empty( $update_data[ $theme['_product_id'] ] ) ) {
			continue;
		}

		$data = $update_data[ $theme['_product_id'] ];
		$slug = $theme['_stylesheet'];

		$item = array(
			'theme'       => $slug,
			'new_version' => $data['version'],
			'url'         => $data['url'],
			'package'     => '',
		);

		/**
		 * Filters the Woo plugin data before saving it in transient used for updates.
		 *
		 * @since 8.7.0
		 *
		 * @param array $item Plugin item to modify.
		 * @param array $data Subscription data fetched from Helper API for the plugin.
		 * @param int   $product_id Woo product id assigned to the plugin.
		 */
		$item = apply_filters( 'update_woo_com_subscription_details', $item, $data, $theme['_product_id'] );

		if ( version_compare( $theme['Version'], $data['version'], '<' ) ) {
			$transient->response[ $slug ] = $item;
		} else {
			unset( $transient->response[ $slug ] );
			$transient->checked[ $slug ] = $data['version'];
		}
	}

	return $transient;
}