WC_Shipping::register_shipping_method( object|string $method )

Register a shipping method.


Description Description


Parameters Parameters

$method

(Required) Either the name of the method's class, or an instance of the method's class.


Top ↑

Return Return

(bool|void)


Top ↑

Source Source

File: includes/class-wc-shipping.php

	public function register_shipping_method( $method ) {
		if ( ! is_object( $method ) ) {
			if ( ! class_exists( $method ) ) {
				return false;
			}
			$method = new $method();
		}
		if ( is_null( $this->shipping_methods ) ) {
			$this->shipping_methods = array();
		}
		$this->shipping_methods[ $method->id ] = $method;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.