Support » Plugin: WooCommerce » Set shipping max weight

  • Resolved zarou88

    (@zarou88)


    Hello! i want to set shipping max weight for each order 30 KG as maximum weight

    How i can do this in WooCommerce …?

    • This topic was modified 2 years, 2 months ago by zarou88.
    • This topic was modified 2 years, 2 months ago by zarou88.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Use something like this in your functions:

    —-

    add_action(‘woocommerce_check_cart_items’,’check_cart_weight’);

    function check_cart_weight(){
    global $woocommerce;
    $weight = $woocommerce->cart->cart_contents_weight;
    if( $weight > 30 ){
    wc_add_notice( sprintf( __( ‘You have %sKg weight and we allow only 30Kg of weight per order.’, ‘woocommerce’ ), $weight ), ‘error’ );
    }
    }

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @zarou88,

    It looks like exact question was asked on Stack Overflow almost 3 years ago which gives the same solution as @rlinsoliveira

    Alternatively you could look at using our Table Rate Shipping extension and setting a max weight.

    Thanks

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. If you have any further questions, you can start a new thread.

    Is there also a code,
    for this if you work with grams? But also till a maximum of order till 30 kg?
    Because it shows only kilo error, while i have all my products in grams.

    Greetings, Marika

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Set shipping max weight’ is closed to new replies.