wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
215 stars 217 forks source link

Per-item shipping charges not being passed to payment gateway #1313

Open siliconforks opened 10 years ago

siliconforks commented 10 years ago

To reproduce:

Tested with WPEC version 3.8.14, WordPress version 3.9.1 (not multisite), Apache version 2.2.27.

(Note that the above instructions are just an example - it appears that this bug affects any shipping module with a get_item_shipping() method.)

JustinSainton commented 10 years ago

@siliconforks Thanks so much for this report. I'll investigate right now.

JustinSainton commented 10 years ago

@siliconforks Are you able to confirm whether or not this behavior existed in the 3.8.13 branch of WP eCommerce?

JustinSainton commented 10 years ago

Marking for further review in 3.9, as I'm not entirely sure the behavior is different from 3.8.13 to 3.8.13 - but I'm also not sure it's correct, either.

siliconforks commented 10 years ago

Definitely this used to work in 3.8.13 - I just created a custom shipping module a few months ago with per-item charges and tested it with 3.8.13, and it worked then.

JustinSainton commented 10 years ago

@siliconforks When you say:

Enter a shipping fee for the item, say $10.

Are you talking about the flat rate settings, under the shipping tab, in the product delivery metabox? That's the only place I'm seeing.

siliconforks commented 10 years ago

Yes, the "Flat Rate Settings" - "Local Shipping Fee" and "International Shipping Fee". (But again, this is just an example - the issue seems to affect any shipping module with get_item_shipping().)

JustinSainton commented 10 years ago

Interesting. I noticed that in both 3.8.13 and 3.8.14 (for me, at least) - it seems to not add this to the shipping at all. Which is why I noted that it seemed broken, but not a .13 --> .14 regression.

mihaijoldis commented 10 years ago

i did some debugging. it seems when it saves the purchase data in the db it just saves the "shipping" price that is set on the shipping calculator and does not add the individual shipping price.

testing on the 14.1 branch i've looked in the ajax.php file and i changed line 646 from $base_shipping = $wpsc_cart->calculate_base_shipping(); to $base_shipping = $wpsc_cart->calculate_total_shipping();

and it seems to work beter now, tested with usps too and its saving the right amount returned by usps.

siliconforks commented 10 years ago

@JustinSainton - I just tried a fresh install of the old plugin version (3.8.13.4) and did the steps in my original report, and the shipping seems to work fine (including sending the full $65 to PayPal) - I'm not sure why you're not seeing it - there must be some difference in settings.

@misulicus I was looking at that part of the code too, but I don't think that's really the problem - I think that value is supposed to be only the base shipping, i.e., the portion of the shipping that's not specific to any one item. The per-item shipping is supposed to get stored in the cart_contents.pnp database field, but that seems to always end up as zero for some reason - I think that is the problem.

rainamanis commented 10 years ago

got one of our theme buyer experience this, the individual shipping (flat rate) is not carried out to paypal...

we fix it by removing "Shipping Origin Zipcode/Postcode" on the Shipping Settings. at least it works for us.

mihaijoldis commented 10 years ago

I just tested on 3.8.14.1 and on 3.8.13 It is working correctly. maybe someone else can retest

mihaijoldis commented 10 years ago

just an update. Tested this for the flat rate issue but i believe the individual shipping charges ONLY work when using Flat Rate. I just tested this on 3.8.13 and the shipping price that gets sent to the gateway is the one under the Table rate settings (5$). The Checkout page shows Table Rate price as 11$ (5$ + 6$ item shipping) but on the paypal page for example it charges for 5$

Per item shipping should only work with Flat rate shipping method. If any other shipping is selected then the individual product shipping should not be considered at all, not even in the calcultor.