Yes, it is possible to query the shipping zone on a WooCommerce checkout page.

You can use the WC_Shipping_Zones class to get the shipping zone for a specific order.

Here is an example of how you can use this class to get the shipping zone for the current order on the checkout page:

$shipping_zone = WC_Shipping_Zones::get_zone_matching_package($package);

Where $package is an array containing package details like shipping address, package weight, and package dimensions.

Alternatively, you can use the WC()->customer->get_shipping_zone() function to get the shipping zone for the current order.

Here’s an example of how you can use this function to get the shipping zone for the current order on the checkout page:

$shipping_zone = WC()->customer->get_shipping_zone();

This will return an object of the WC_Shipping_Zone class, which contains information about the shipping zone, including its name, region, and the methods available for that zone.

It’s important to note that the above examples will only work on the checkout page when the user has already entered their shipping address and the shipping zone has been determined.

(Visited 56 times, 1 visits today)
Was this article helpful?
YesNo
Close Search Window