WC_Abstract_Order::has_shipping_method()publicWC 1.0

Check whether this order has a specific shipping method or not.

Method of the class: WC_Abstract_Order{}

No Hooks.

Return

true|false.

Usage

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->has_shipping_method( $method_id );
$method_id(string) (required)
Method ID to check.

WC_Abstract_Order::has_shipping_method() code WC 8.7.0

public function has_shipping_method( $method_id ) {
	foreach ( $this->get_shipping_methods() as $shipping_method ) {
		if ( strpos( $shipping_method->get_method_id(), $method_id ) === 0 ) {
			return true;
		}
	}
	return false;
}