VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: dannette on March 21, 2023, 21:58:02 PM

Title: Paypal plugin calculating package fee with shipping cost included
Post by: dannette on March 21, 2023, 21:58:02 PM
Our client would like the 5% package fee to just be on the total order, not including shipping and tax, but it is including shipping and tax and then adding the 5% to that amount.
Scenario:
Item totals are $37.00
With tax items are $39.22
Shipping is $8.00
Payment should add 5% to $37.00 but it adds it on $47.22 - adding on $2.36 instead of $1.85
Total is $49.58 instead of $49.07

Also is there a way to exclude that addon fee for one category? I would imagine I'd have to edit the plugin, but could use help in knowing where to start.

In the Paypal plugin, I do have Cost Method Calculation set to fixed (not progressive).

Versions: Joomla 4.2.9 and Virtuemart 4.0.12

PS - are we going to get a new board for VM 4?
Title: Re: Paypal plugin calculating package fee with shipping cost included
Post by: Jörgen on March 22, 2023, 10:26:09 AM
You total payment through Paypal is 47,22.

It consist of cart items 39,22 incl vat and 8,00 shipping.

Why should it only add to payment withaout tax ?

This works as expected IMHO.

Jörgen @ Kreativ Fotografi
Title: Re: Paypal plugin calculating package fee with shipping cost included
Post by: dannette on March 22, 2023, 14:46:14 PM
The question is how to get it to NOT add 5% to the tax and shipping. We want 5% on the original total of $37 for the items, not on tax and shipping too.
Title: Re: Paypal plugin calculating package fee with shipping cost included
Post by: GJC Web Design on March 23, 2023, 10:46:43 AM
the calc is done in the administrator\components\com_virtuemart\plugins\vmpsplugin.php

but u can over ride this is the plugin by adding the function

see for example the weight shipping plugin

   function getCosts (VirtueMartCart $cart, $method, $cart_prices) {

      if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
         return 0.0;
      } else {
         if(empty($method->shipment_cost)) $method->shipment_cost = 0.0;
         if(empty($method->package_fee)) $method->package_fee = 0.0;
         return $method->shipment_cost + $method->package_fee;
      }
   }