WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wc_shipping_methods_have_changed() WC 3.2.0

See if the methods have changed since the last request.

Хуков нет.

Возвращает

true/false.

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

wc_shipping_methods_have_changed( $key, $package );
$key(число) (обязательный)
Key of package.
$package(массив) (обязательный)
Package data array.

Список изменений

С версии 3.2.0 Введена.

Код wc shipping methods have changed: woocommerce/includes/wc-cart-functions.php WC 4.3.1

<?php
function wc_shipping_methods_have_changed( $key, $package ) {
	// Lookup previous methods from session.
	$previous_shipping_methods = WC()->session->get( 'previous_shipping_methods' );
	// Get new and old rates.
	$new_rates  = array_keys( $package['rates'] );
	$prev_rates = isset( $previous_shipping_methods[ $key ] ) ? $previous_shipping_methods[ $key ] : false;
	// Update session.
	$previous_shipping_methods[ $key ] = $new_rates;
	WC()->session->set( 'previous_shipping_methods', $previous_shipping_methods );
	return $new_rates !== $prev_rates;
}