ethercreative / web-payments

Web Payments for Craft Commerce
Other
5 stars 7 forks source link

Line Item price changes via plugin are not reflected #7

Open aladrach opened 4 years ago

aladrach commented 4 years ago

Changing prices via: Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function(LineItemEvent $e) show up correctly in the Commerce checkout, but in Apple/Google Pay, the changes are not reflected, and it tries to charge the amount before those changes.

matt-adigital commented 3 years ago

I've also just encountered this issue. Opened up src/services/StripeService.php on line 157 and changed $item->purchasable->salePrice * $item->qty within the brackets to be $item->subtotal for a quick test and this has fixed the issue.

In my local copy with this edit, the complete version of line 157 now reads as: $amount = round($item->subtotal * 100);

This has preserved the custom pricing logic I've used elsewhere. Can this please be implemented in the next release @Tam? Thanks.