• Resolved wolleamore

    (@wolleamore)


    Hello,
    I need help with following issue:
    My products are highly customizable. Product type is “simple” and customization is done by “Advanced product fields” plugin, which also alters product weight depending on chosen options. But as soon as the visitor navigates to the checkout and changes his country or postal code, (which triggers a refresh of the shipping calculations), – cart weight resets, returning wrong shipping costs. Products have certain basic weight set in WooCommerce configuration, and the rest is added by Advanced Product Fields plugin. After cart “reset”, WBS sees only basic weight of products.

    Example:
    Shipping to Japan.
    Basket weight from 0 to 0.499 kg – shipping cost PLN 43;
    Basket weight from 0.5 to 0.999 kg – shipping cost PLN 51;

    https://ibb.co/mc1PRCj

    My cart is in the second compartment (weight 0.81 kg = shipping costs PLN 51).
    When I select the shipping country for the first time on the summary page, the displayed shipping amount is correct (PLN 51). But when I change the country again (switch to South Korea – same shipping zone) – only the rate from the first range (PLN 43) is displayed. Even if I go back to the cart and refresh it, the cheapest shipping is still displayed. Only when I change the contents of the cart – add or subtract a product – the correct shipping costs appear again.

    Where WBS is taking weight from ? If from product – can it be changed to cart item weight ? Where should I be looking for code responsible for weight calculations ?

    Thank You for your help.

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

    (@dangoodman)

    Hello,

    The related WBS code is in the PackageConverter class in the vendor dir. It obtains each item’s weight via the built-in WooCommerce WC_Product::get_weight() function. Please check its code for more details on overriding the value it returns.

    Thread Starter wolleamore

    (@wolleamore)

    Hello Dan, thank You for Your reply. Can be this code changed to use cart weight only ? I don’t want to mess up the plugin operation.

    Additionally: Is there any chance for upcoming plugin updates, to make optional choice which weight (product or cart) shall be taken into account for weight calculations ?

    Plugin Author Dan

    (@dangoodman)

    Hello @wolleamore,

    What package field represents the “cart weight”? If that is not a field, could you explain what that means?

    Thread Starter wolleamore

    (@wolleamore)

    Hello @dangoodman

    I’m not sure, I’m not a programmer, but try to understand the mechanics. If the rates, work at first but fail during modification, there must be an easy solution to keep products settings/parameters from first approach (code snippet?)

    Plugin Author Dan

    (@dangoodman)

    Well, it’s not the problem with the rates. It is the weights. The plugin calculates the rates correctly based on the weight it “sees”. But the weights it sees are not the custom ones.

    WooCommerce shipping plugins are more reactive than proactive. WooCommerce “decides” when to call them, how to display and cache the results, and what data to feed them. WBS does not control this flow. If the flow is broken, it’s affected by a third party.

    In your case, it is worth checking if the advanced fields plugin provides the weights similarly to how WooCommerce does that by default.

    Thread Starter wolleamore

    (@wolleamore)

    @dangoodman

    Thank You for Your reply. I’ll look further into this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Weight resetting when changing destination (country)’ is closed to new replies.