My custom shipping method doesn’t show up in the checkout page
-
I made a custom shipping method for Woocommerce. It shows in shipping zones, and it’s been added to all the zones, but during checkout, the option for selecting this method doesn’t show up.
Here’s my code:
add_action('woocommerce_shipping_init', 'UPS_number_shipping_method'); function UPS_number_shipping_method() { if (!class_exists('UPS_Number_Shipping_Method')) { class UPS_Number_Shipping_Method extends WC_Shipping_Method { public function __construct($instance_id = 0) { $this->id = 'UPS_number_shipping'; $this->instance_id = absint($instance_id); $this->domain = 'UPS_number_shipping'; $this->method_title = __('UPS Number', $this->domain); $this->method_description = __('Shipping method to be used when dealer has a UPS number', $this->domain); $this->title = __('UPS Number', $this->domain); $this->supports = array( 'shipping-zones', 'instance-settings', 'instance-settings-modal', ); $this->init(); } ## Load the settings API function init() { $this->init_form_fields(); $this->init_settings(); $this->enabled = 'yes'; $this->title = __('UPS Number', $this->domain); add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_admin_options')); } public function calculate_shipping($packages = array()) { $this->add_rate(0); } } } } add_filter('woocommerce_shipping_methods', 'add_UPS_number_shipping'); function add_UPS_number_shipping($methods) { $methods['UPS_number_shipping'] = 'UPS_Number_Shipping_Method'; return $methods; }
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘My custom shipping method doesn’t show up in the checkout page’ is closed to new replies.