jeffharrell / minicart

The minicart is a great way to improve your PayPal shopping cart integration.
MIT License
501 stars 211 forks source link

MiniCart 3.0.5 still not passing weight over to PayPal for shipping calcs #284

Open adpinc opened 8 years ago

adpinc commented 8 years ago

The new cart is very nice. I've been trying to pass over weight for the items to use the PayPal shipping calculator. It works fine without minicart, and it also works fine with minicart.js 2.5.0. I've tried digging into the code, but without being intimately knowledgable about PayPal and the original code, it's difficult to get to the bottom of it. I was able to pass over weight_cart by incrementing the value of the hidden field, but the calculated shipping still isn't correct. It would be great if this could be fixed. I want to use the new cart.

unwork commented 8 years ago

I have this same issue. Shipping costs by weight are not being passed when I implement minicart-js. It's otherwise working fine.

I've been digging through all source files and trying different methods but couldn't figure out how to make it work. Any ideas will be greatly appreciated.

Sarke commented 7 years ago

Replace:

<input type="hidden" name="shipping_<%= idx %>" value="<%= items[i].get("shipping") %>" />            <input type="hidden" name="shipping2_<%= idx %>" value="<%= items[i].get("shipping2") %>" />

with

<% if (items[i].get("shipping")) { %><input type="hidden" name="shipping_<%= idx %>" value="<%= items[i].get("shipping") %>" /><% } %>            <% if (items[i].get("shipping2")) { %><input type="hidden" name="shipping2_<%= idx %>" value="<%= items[i].get("shipping2") %>" /><% } %>        <% if (items[i].get("weight")) { %><input type="hidden" name="weight_<%= idx %>" value="<%= items[i].get("weight") %>" /><% } %>
jeffreyscottfrench commented 7 years ago

I'm getting a value of "undefined" passed to PayPal for shipping values when none are set explicitly by the item (shipping is being handled on a per order basis at PayPal.com). Hoping these conditional statements are going to solve that as well. @Sarke - thanks for the note!