add_filter('woocommerce_shipping_methods', 'add_custom_shipping_method'); function add_custom_shipping_method($methods) { $methods['custom_shipping'] = 'Custom_Shipping_Method'; return $methods; } class Custom_Shipping_Method extends WC_Shipping_Method { public function __construct() { $this->id = 'custom_shipping'; $this->method_title = 'Benutzerdefinierte Versandmethode'; $this->method_description = 'Eine benutzerdefinierte Versandmethode für Testzwecke.'; $this->enabled = 'yes'; $this->init(); } public function init() { $this->title = $this->get_option('title'); } public function calculate_shipping($package = array()) { $rate = array( 'id' => $this->id, 'label' => $this->title, 'cost' => 10.00, 'calc_tax' => 'per_order', ); $this->add_rate($rate); } }