2

Hoping i can get a solution for the following undesired behavior: I'm running Wordpress 4.5.3 with Woocommerce 2.6.4. I also have installed WooCommerce Payment Gateway Based Fees 2.2.16. This plugin allows me to add PayPal fees at checkout time.

I'm also as a default not allowing cash checkout.

The problem I have is that if a user uses a coupon that makes their total zero...I would have expected intuitively that i) PayPal fees would not be showing ii) you could simply place the order to checkout.

Neither is happening.

So I instead decided to enable cash checkout and automatically disable it -- ( using unset(), could not figure out a way of setting a gateway only unsetting ) -- if the cart total was equal to the PayPal fee using this hook: woocommerce_available_payment_gateways. This would at least allow them to checkout without the only option being the PayPal gateway.

Problem is that I have still not figured out how to stop the PayPal fees from showing and being added to the total.

Any guidance / help much appreciated

Payges
  • 61
  • 4
  • You check WooCommerce Payment Gateway Based Fees plugin and thir doc ?, may be there is any kind of rule to show fees or not – mollie Aug 07 '16 at 08:40

2 Answers2

2

In the plugin, there is option Maximum Value to allow you to deactivate the product fee if the product price exceeds a certain amount . Please read https://docs.woocommerce.com/document/payment-gateway-based-fees/

After check this plugin. there is no option for minimum amount. but you can make fee 0 if total amount is 0. open the file woocommerce-additional-fees\classes\class-wc-add-fees.php.in calculate_gateway_fee_product add the code.

if($check_total==0){
   return $check_total;
}

before return $fees_calc; in line no 2122 . if any query you can comment.

mollie
  • 140
  • 1
  • 16
  • Many thanks for replying but don't I need the contrasting option which dies not exist: Minimum value - to allow you to deactivate the product fee... And would need to set that to zero.... Essentially this is the desired 'option' which I need to figure out how to code... I could be mistaken and will attempt the max value setting when I get to the computer... – Payges Aug 07 '16 at 09:10
  • you check this option ? it is not working.? you are using plugin that calculate fees and add to the total price. if pluign have not option to set rules than you need to edit plugin files or check which hook worked on checkout. – mollie Aug 07 '16 at 09:15
  • Yes it is as i said...we need a min value option....or essentially the subject of my post - how to code for that seeing that it is missing / that this scenario has not been catered for by the lugin? thanks – Payges Aug 07 '16 at 10:08
  • can you send me zip file of this plugin, i will check the hook for it. – mollie Aug 07 '16 at 10:33
  • Thanks for your offer mollie..been out all day and had a thought..came back home and tested and it worked :-) The Plugin allows you to put a fee for any payment gateway So i set one up for cash: I placed a fee of -0.2 (to counter the paypal fee of 0.2) and set its max value at 0.1...meaning realistically it would only apply when the cart is zero So far so good from testing... – Payges Aug 07 '16 at 18:32
  • actually...it needs a refresh of the page ....to set itself aright...so not an elegant solution – Payges Aug 07 '16 at 18:37
  • how do i send you the zip? – Payges Aug 07 '16 at 18:39
  • amit.singh819@gmail.com if you need – mollie Aug 08 '16 at 11:02
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/120451/discussion-between-payges-and-mollie). – Payges Aug 08 '16 at 17:04
  • Thanks for attempting..unfortunately your solution does not work..i'm not sure if you actually tried it(?). I think either that function is not affecting the calculation or that there is another function elsewhere that plays a part later.. even without your conditional , if i were to set $fees_calc = 0 or return null or return 0 it has no affect and the Paypal additional fees set in its settings page still show – Payges Aug 12 '16 at 15:56
1

Could not get the plugin to do what i needed - i think its a poor oversight on behalf of the developer(s).

Seeing that all the other features of the plugin for me were overkill and not required..i ditched the plugin and simply added my own code for PayPal Fees with simple modification of this snippet:

Add a basic surcharge to all transactions https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/

Payges
  • 61
  • 4