• Resolved sj0175

    (@sj0175)


    Hi,

    I’m trying to change our default shipping selection so that our 48-hour track option is always selected as default.

    I’ve tried –
    function reset_default_shipping_method( $method, $available_methods ) {
    $default_method = ‘shipping_method_0_flat_rate3’; // service name which will select default
    if( array_key_exists($method, $available_methods ) )
    return $default_method;
    else
    return $method;
    }
    add_filter(‘woocommerce_shipping_chosen_method’, ‘reset_default_shipping_method’, 10, 2);

    But can not get it to work can anyone help?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    Just to make sure: Is there a reason why you don’t simply drag-and-drop the shipping method to the top of the list? I’m asking as the first shipping method in that list is the one that’ll be selected by default (provided the user matches the shipping zone of course). If you’re wondering, here’s what that looks like on my local testing website:


    Link to image: https://d.pr/i/TOW5lN

    Thread Starter sj0175

    (@sj0175)

    Hi @riaanknoetze,

    Thank you for getting back to me.

    This simple method won’t work for us as we are using another Shipping Rule plugin alongside WooCommerce and we have had to script in the order of shipping options.

    Hence why we need to override the WooCommerce selected default shipping method manually.

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @sj0175 If another plugin is going around the default WooCommerce shipping methods (meaning, not adding new methods in the zones), then we would suggest reaching out to that developer for a solution to the issue. If the plugin was adding the methods to the zones, then the method described above would be the solution here.

    If that developer is not wanting to help, we suggest reaching out to a developer from this page: https://woocommerce.com/customizations/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce shipping changing the default’ is closed to new replies.