WC_Helper_Updater::get_update_check_payload
The products to ask WooCommerce.com about, with the file ID and installed version of each.
Covers every subscription plus every installed plugin and theme carrying a Woo header, whether or not it has a subscription. Every caller has to send the same payload: the server decides the autoupdate flag from the installed version, and the response is cached under a hash of the payload.
Method of the class: WC_Helper_Updater{}
No Hooks.
Returns
array. Payload keyed by product ID.
Usage
$result = WC_Helper_Updater::get_update_check_payload(): array;
Changelog
| Since 11.2.0 | Introduced. |
WC_Helper_Updater::get_update_check_payload() WC Helper Updater::get update check payload code WC 11.2.2
private static function get_update_check_payload(): array {
$payload = array();
foreach ( WC_Helper::get_subscriptions() as $subscription ) {
$product_id = (int) $subscription['product_id'];
$payload[ $product_id ] = array(
'product_id' => $product_id,
'file_id' => '',
'version' => '',
);
}
$installed = array_merge( WC_Helper::get_local_woo_plugins(), WC_Helper::get_local_woo_themes() );
foreach ( $installed as $data ) {
if ( ! isset( $payload[ $data['_product_id'] ] ) ) {
$payload[ $data['_product_id'] ] = array(
'product_id' => $data['_product_id'],
);
}
$payload[ $data['_product_id'] ]['file_id'] = $data['_file_id'];
$payload[ $data['_product_id'] ]['version'] = (string) ( $data['Version'] ?? '' );
}
return $payload;
}