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.
Return Return
(bool|void)
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; }