in Woocommerce, Wordpress

WooCommerce add custom shipping methods

WooCommerce provides a facility to add custom shipping methods by wrapper function `woocommerce_register_shipping_method`. You can add your custom shipping method as many as you want to add. It accepts a class name or a class object.


/**
* Register a shipping method.
*
* Registers a shipping method ready to be loaded. Accepts a class name (string) or a class object.
*
* @package WooCommerce/Classes/Shipping
* @since 1.5.7
*/
function woocommerce_register_shipping_method( $shipping_method ) {
WC()->shipping->register_shipping_method( $shipping_method );
}

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.