• fabiowork

    (@fabiowork)


    On the customer’s website will have shipping by weight
    But from “x” weight begins to have an additional cost per kg

    I know you can add the price per kg but the product counts the grams and not the total kg

    ex:
    1 kg – 32.40
    More than 1 kg – 32.40 (for the first kg) + 4 EUR per extra kg

    If the product is 1.30 Kg counts that weight and not 2kg
    And I want it to count 2kg

    Thx

Viewing 6 replies - 1 through 6 (of 6 total)
  • Joey – a11n

    (@jricketts4)

    @fabiowork – can you send a screenshot of your product settings? I’m having a little bit of a hard time understanding how you’re currently charging for a product based on weight with default WooCommerce functionality.

    – Joey

    con

    (@conschneider)

    Engineer

    Hi there,

    This will always round the weight in cart up.

    add_filter('woocommerce_cart_contents_weight', 'round_cart_contents_weight');
    function round_cart_contents_weight($weight) {
    	$weight = ceil($weight);
    	return $weight;
    }

    Kind regards,

    Thread Starter fabiowork

    (@fabiowork)

    Thx for helping
    Where i can add this code on my site?

    Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    @fabiowork You’ll want to add that to your theme’s functions.php file.

    If you are not familiar with coding, I don’t recommend messing up with the files themselves. In that case, you can use a plugin like Code Snippets, which will let you add the snippet through the admin dashboard.

    Thread Starter fabiowork

    (@fabiowork)

    I put the code in both functions.php of my theme and the snippet code and it’s not working because the price of the weight per kg is counting the grams

    Thread Starter fabiowork

    (@fabiowork)

    I put the code in both functions.php of my theme and the snippet code and it’s not working because the price of the weight per kg is counting the grams and not the total kg

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Round Weight’ is closed to new replies.