woocommerce_cart_shipping_packages filter-hookWC 1.5.4

Filters the shipping packages for the cart.

Usage

add_filter( 'woocommerce_cart_shipping_packages', 'wp_kama_woocommerce_cart_shipping_packages_filter' );

/**
 * Function for `woocommerce_cart_shipping_packages` filter-hook.
 * 
 * @param array $packages The shipping packages.
 *
 * @return array
 */
function wp_kama_woocommerce_cart_shipping_packages_filter( $packages ){

	// filter...
	return $packages;
}
$packages(array)
The shipping packages.

Changelog

Since 1.5.4 Introduced.

Where the hook is called

WC_Cart::get_shipping_packages()
woocommerce_cart_shipping_packages
woocommerce/includes/class-wc-cart.php 1669-1691
$shipping_packages = apply_filters(
	'woocommerce_cart_shipping_packages',
	array(
		array(
			'contents'        => $this->get_items_needing_shipping(),
			'contents_cost'   => array_sum( wp_list_pluck( $this->get_items_needing_shipping(), 'line_total' ) ),
			'applied_coupons' => $this->get_applied_coupons(),
			'user'            => array(
				'ID' => get_current_user_id(),
			),
			'destination'     => array(
				'country'   => $this->get_customer()->get_shipping_country(),
				'state'     => $this->get_customer()->get_shipping_state(),
				'postcode'  => $this->get_customer()->get_shipping_postcode(),
				'city'      => $this->get_customer()->get_shipping_city(),
				'address'   => $this->get_customer()->get_shipping_address(), // This is an alias of address_1, provided for backwards compatibility.
				'address_1' => $this->get_customer()->get_shipping_address_1(),
				'address_2' => $this->get_customer()->get_shipping_address_2(),
			),
			'cart_subtotal'   => $this->get_displayed_subtotal(),
		),
	)
);

Where the hook is used in WooCommerce

Usage not found.