• Resolved sheefoo

    (@sheefoo)


    Hi,

    I am doing weight based shipping based on a local delivery service, and we have decided to offer free shipping for all orders above $50, by setting the max subtotal to $50 in the shipping variations.

    All orders above $50 are offered the free shipping option available in woocommerce.

    This works most of the time, except when I implement a coupon for 15% discount, and suddenly an order that has a subtotal of $50+ before discount is applied falls through the hole.

    Since the subtotal is above $50, the plugin hides the shipping options, but since the total is below $50 after discount, woocommerce does not show the free shipping option either.

    How do I resolve this?

    https://wordpress.org/plugins/weight-based-shipping-for-woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dan

    (@dangoodman)

    Hi,

    The plugin is not aware of discounts for now. It will be implemented some day but not sure when. Unfortunately, I can’t think of any workaround to make it work for you right now.

    Consider using our advanced shipping plugin which can handle discounted subtotal well. Feel free to contact us there for more detail.

    Thread Starter sheefoo

    (@sheefoo)

    Hi,

    I appreciate the response. I have attempted to make my own edit to the codes just to try and get it to work, and right now it shows the shipping options when the subtotal falls below $50 after the discounts, but do not hide the options after it exceeds the $50 set in max_subtotal.

    public function calculate_shipping()
            {
                $cart = WC()->cart;
    
                $weight = $cart->cart_contents_weight;
                $actual_subtotal = $cart->subtotal_ex_tax - $cart->discount_cart;
                $actual_subtotal_with_tax = $cart->subtotal - $cart->discount_cart_tax;
                if ($this->min_weight && $weight < $this->min_weight) {
                    return;
                }
                if ($this->max_weight && $weight > $this->max_weight) {
                    return;
                }
    
                if ($this->min_subtotal || $this->max_subtotal) {
                    $subtotal = $this->subtotal_with_tax ? $actual_subtotal_with_tax : $actual_subtotal;
                    if ($this->min_subtotal && $subtotal < $this->min_subtotal) {
                        return;
                    }
                    if ($this->max_subtotal && $subtotal > $this->max_subtotal) {
                        return;
                    }
                }

    Do you have any idea what went wrong since I basically only replaced the variables with the discounted subtotals?

    Thread Starter sheefoo

    (@sheefoo)

    Hmm. Could be a problem on the theme end, since it works fine when I add items to the cart from scratch instead of updating the cart.

    Plugin Author Dan

    (@dangoodman)

    I’d say it should work. Can’t say for sure without running and testing.

    It also could be a caching issue. Make sure you changed the cart in some way after code modification, e.g. by increasing item quantity.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Facing a problem with Shipping Rate’ is closed to new replies.