• Resolved frownfelter

    (@frownfelter)


    I have used USPS simple for a while and its great but due to tax and invoicing reasons I need to add “local pickup” to the site. The issue I am having is that woocommece defaults to local pickup which could cause some issues.

    I created the local pickup through the woocommerce->settings->Shipping->Shipping Zones, then creating a local pickup

    Is there a way to default the shipping method to USPS Simple for new and existing customers? (I did verify that a new user does default to local pickup

Viewing 1 replies (of 1 total)
  • Plugin Author Dan

    (@dangoodman)

    Hi,

    You can sort shipping options so the local pickup option appears last with the following code snippet:

    add_filter('woocommerce_package_rates', static function ($rates) {
    
        foreach ($rates as $key => $rate) {
    
            $pickup =
                $rate->get_method_id() === 'local_pickup' ||
                stripos($rate->get_label(), 'pickup') !== false ||
                stripos($rate->get_label(), 'pick up') !== false;
    
            if ($pickup) {
                unset($rates[$key]);
                $rates[$key] = $rate;
            }
        }
    
        return $rates;
    
    }, 10, 2);
Viewing 1 replies (of 1 total)

The topic ‘set USPS Simple method as default shipping method’ is closed to new replies.