Cart in VM does not match Paypal cart when coupon applied

Started by aerdna, October 06, 2016, 07:38:20 AM

Previous topic - Next topic

aerdna

VM 3.0.16, Joomla 3.6.2

I believe I am seeing the same issue as is in this older, unresolved post: http://forum.virtuemart.net/index.php?topic=130424.msg449331#msg449331

Does anyone know if there's been a plugin update beyond what is included in VM 3.0.16 download that might address this?

I'm using paypal standard plugin.  I've created a gift coupon for 5.99 with min purchase of 0.  I have an item in my shop that is 1.99, plus 5.99 shipping. When I add the 1.99 item to my cart, and apply the gift coupon for 5.99, the cart shows 1.99 total. This is as expected, but paypal total is 5.99.

I'm using the "Shopping Cart" type in the PayPal plugin so that the cart contents are detailed in paypal. When I get to paypal, it displays:
Baby Socks 1.99
Item Total:  1.99
Handling: 5.99
Discount: 1.99
Total:  5.99

Somewhere along the way, my coupon value didn't get properly applied as it should have been applied to shipping costs too within paypal.   I see the following in the debug log (below).  I am setting paypal action to Authorize and Capture.  I'm wondering if this is due to the fact that my coupon discount amount is greater than the product total, so instead of going in the negative (or subtracting out the shipping), it applies as much of the coupon as possible to just the product total to avoid going negative. 

I'd like for the VM cart to match paypal cart and to be able to offer free shipping coupons regardless of the cart total, so is there another way to do this?  For example, how I might use the [no_shipping] flag below but via a coupon or discount instead of a shipping method?  I've looked at the paypalstd.php file addPrices() function and am wondering if I could do a quick check there to update the post_variables and remove or reduce shipping costs but I don't see where I would get the cart total to know if I should set the no_shipping flag or just offset some of the shipping costs based on the discount.


DEBUG PayPal request:: Array
(
    [cmd] => _ext-enter
    [redirect_cmd] => _cart
    [paymentaction] => authorization
    [upload] => 1
...
   [rm] => 2
    [bn] => VirtueMart_Cart_PPA
    [no_shipping] => 0
    [no_note] => 1
    [cpp_header_image] => <snip.....>
    [item_name_1] => Baby Socks
    [amount_1] => 1.99
    [quantity_1] => 1
    [handling_cart] => 5.99
    [discount_amount_cart] => 5.99
)

Sorry if this post is confusing.  Thanks for reading and I hope you can help.

Andrea





djam

We are having the same issue with VM 3.0.16, VM 3.0.18 test version, Joomla 3.6.2, AWO Coupon 2.5.0, AWO Coupon 2.5.0, AWO Coupon 2.5.1
Using paypal stand plugin, only when we have a gift coupon that exceeds the product amount (if product amount is more than coupon,  works as expected).  For example, on an order with a balance of $4.95 after applying the GC, Paypal tried to charge the full shipping amount which is in this case was $10.00.
In addition, if authorize.net payment is used to pay the remaining shipping costs,  the checkout page is only refreshed (no error messages) so the customer is unable to pay for the remaining shipping costs.
Checking into this case, it appears that the credit card data number data has been cleared so no order can be processed.
Thanks for any help with this,
Deb


aerdna

I actually just fixed this in my version of the paypal standard plugin by modifying the addPrices() function in paypal/paypal/helpers/paypalstd.php to apply a coupon first to the cart total and then if there is a remaining coupon balance, to apply it to the shipping and handling cost, and setting the $post_variables['no_shipping'] accordingly if the coupon was enough to provide free shipping and updating the discount_amount_cart to reflect the correct adjusted discount. 

I'm not sure why the paypal plugin writers don't add something like this to the official source and maybe provide a flag in the admin configuration to make it an optional capability.  I think others might find it useful, but I guess it is a "nice to have" thing, not a bug fix so not exactly a top priority.  Once I started digging and testing, it ended up being fairly straight-forward to change.

However, if you don't want to "hack" the plugin, you could always just make sure your coupons require a minimum purchase price so the discount will never be more than the cart total (before shipping is added).  You could also consider setting up a shipping type that allows free shipping if certain minimums or maximums are met.

I haven't used authorize.net so I can't speak for how that is behaving.






Typhoon365

We are also experiencing this same issue, VM 3.0.10.  Applying a AwoCoupon gift certificate brings the Virtuemart shopping cart to $0 but when redirected to PayPal it is still charging the customer our shipping and handling fee, that should of been discounted as part of the gift certificate being applied.

Any chance it has been or could be fixed in core please ?  Seems logical to incorporate "aerdna" fix unless it causes any other issues ?

seyi

Hello,

If you do not care that customers see their shopping cart in Paypal, then in Paypal configuration, setting 'Payment type' to 'Normal' instead of 'Shopping cart' works better.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate