wc_get_shipping_zone

Get the shipping zone matching a given package from the cart.

Description

(WC_Shipping_Zone) wc_get_shipping_zone( (array) $package ); 

Returns (WC_Shipping_Zone)

Parameters (1)

0. $package (array)
The package.

Usage

  1. if ( !function_exists( 'wc_get_shipping_zone' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // The package. 
  5. $package = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_get_shipping_zone($package); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_get_shipping_zone( $package ) { 
  2. return WC_Shipping_Zones::get_zone_matching_package( $package );