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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); | |
} |
Where do I have to add this code to be able to create more shipping methods?
Does it work with Woocommerce 2.6+ ?
Hi Eric,
Can you try this plugin I have made for the same feature? https://github.com/mehulkaklotar/woo-dynamic-shipping
After Installing, Go to Settings -> WooCommerce Dynamic Shipping