woocommerce_shipping_package_hash_ignored_fields filter-hookWC 11.0.0

Filters package fields that should not affect the shipping-rate cache hash.

Usage

add_filter( 'woocommerce_shipping_package_hash_ignored_fields', 'wp_kama_woocommerce_shipping_package_hash_ignored_fields_filter', 10, 2 );

/**
 * Function for `woocommerce_shipping_package_hash_ignored_fields` filter-hook.
 * 
 * @param array $ignored_fields Package field names ignored while generating the cache hash.
 * @param array $package        Package of cart items.
 *
 * @return array
 */
function wp_kama_woocommerce_shipping_package_hash_ignored_fields_filter( $ignored_fields, $package ){

	// filter...
	return $ignored_fields;
}
$ignored_fields(array)
Package field names ignored while generating the cache hash.
$package(array)
Package of cart items.

Changelog

Since 11.0.0 Introduced.

Where the hook is called

WC_Shipping::get_package_hash()
woocommerce_shipping_package_hash_ignored_fields
woocommerce/includes/class-wc-shipping.php 428-439
$ignored_fields = apply_filters(
	'woocommerce_shipping_package_hash_ignored_fields',
	array(
		'subtotal',
		'total',
		'package_id',
		'package_name',
		'rates',
		'package_index',
	),
	$package_to_hash
);

Where the hook is used in WooCommerce

Usage not found.