WooCommerce Add Charges To Payment Gateway
contribution to this plugin (new version!) (24 posts)

  1. belpha
    Posted 2 years ago #

    Hello I need some extra features to this cool plugin, so I added them by myself.

    I would like to share them with you and possibly to help the development of this plugin.

    So the changelog for "my" version 0.11 is:
    - add "mixed" type mode for extra fees (fixed + percentage)
    - add "include shipping in extra charge computation" option
    - display extra fees also in cart totals
    - javascript real-time selection of extra chargers fields / options
    - better algorithm for computation

    I don't know how to add the .php to this page, so you can download it from here: http://www.sendspace.com/file/i3h9ag

    Feel free to try it and please post your comment here.


  2. jayraaj.chavan
    Posted 2 years ago #

    Hello belpha,

    Great contribution to this plugin as needed. Only one issue i am facing is that the total amount is correct but the row is missing from the tables. I would be very thankful if you solve this issue for me. Thanks in advance.

    Please find the details below for your reference..

    WordPress version : 3.5
    Woocommerce Version : 2.0.13
    Theme : http://demo.yithemes.com/bazar/

  3. dekaru
    Posted 2 years ago #

    Hello. the mixed type is definitely very welcome! Could you tell us is the issue mentioned by jayraaj is fixed?

  4. jayraaj.chavan
    Posted 2 years ago #

    Hello belpha,

    Thank u for the contribution. Bill still my issue is persisting. The total amount is correct but the row is missing from the tables in bazar theme..

  5. belpha
    Posted 2 years ago #

    Hello Jayraaj and Dekaru, I'm glad you find my contribution useful!

    I checked again and I found a mistake using PHP_ROUND_HALF_UP, as fix I used 'ceil' function. I made a quick test, now the row displays correctly, please try it out and let me know, thanks!

    v 0.12 http://www.sendspace.com/file/1yxl5x

    EDIT: I just noticed you're talking about Bazar theme, I'm using CatchBox and I can see rows (the bug I fixed was on the value of the row).
    I never tried Bazar, this plugin uses standard hooks/actions from WooCommerce, maybe the Bazar overwrites them?

  6. dekaru
    Posted 2 years ago #

    Hello belpha!

    Thank you so much for the quick response!

    I noticed that the extra charges appear on my cart page before I've actually selected a payment method.

    Also, it seems that the plugin breaks the calculation auto-refresh on the initial checkout page: I select different payment gateways but the subtotal/shipping/fee/total doesn't update. I'm using the discover theme, fwiw.

    You can see a demo at:


    Is there any way these issues can be fixed?

  7. belpha
    Posted 2 years ago #

    I had a look to your website, actual pc is Win7, Firefox 23.0.1.

    1) added two items to chart (price 200 + 100)

    2) default payment type (price 200 + 100)

    3) MercadoPago type (price 200 + 100 + 6% = 312)

    4) going back to the chart (price 200 + 100 + 6% = 312)

    Are you sure that you're running v 0.12?
    Cause at point 3 (with percentage) you should see a value of additional fees written in USD and not as xx%, also at point 4 you should get a line "additional fees" and value in USD.

    Do you get the same output?

    Here my shop, have a try: http://www.toxicindustries.net/?post_type=product

  8. dekaru
    Posted 2 years ago #

    Hello Fabrizio! Thank you very much for looking into this matter. I had actually deactivated type plugin version in favor of the original due to those issues I was having, however I have retired yours now so you can check it's behavior :)

  9. belpha
    Posted 2 years ago #

    About the "extra fees before payment method", go to settings and check if your default payment type has "--select--" in Extra Charges Type field.

    About the failed refresh, you're right, once selected a payment type it doesn't refresh. To force it to refresh, I selected the new type of payment, changed "envio" type and get back to original "envio".

    It seems the the JavaScript function I wrote doesn't work properly with your theme (as you can see it works with CatchBox, I was lucky). To solve it quickly, it would be better to translate it in jQuery but I'm not so skilled, we must find a js guru that help us :/

  10. dekaru
    Posted 2 years ago #


    Re: extra fees before choosing payment method
    I actually didn't have a default payment method set; once I set it the notice before choosing then showed the "MercadoPago" payment method even though my default payment method was set to electronic transfer.
    I tried setting electronic transfer (default method) both to "--select--" as well as fixed with 0, but no luck: the shopping cart still displays the "MercadoPago" non-default payment method.

    Re: failed refresh
    I see, it seems to work that way, although I have know noticed that the total sent to PayPal/MercadoPago does not reflect the updated fee (total+extra charge) at all! :O Seems like we've struck a wall

  11. panosdotk
    Posted 2 years ago #

    The issue with Bazar theme still exist? I really need a solution

  12. belpha
    Posted 2 years ago #

    @ Dekaru: try now, I made a couple of fix for display the fees correctly and add them to the gateway.

    About "mixed" charges, this is the algorithm (the one used by PayPal):

    NEW_TOTAL = (TOTAL + fixed) / (1 - percentage)

    Note that NEW_TOTAL is always rounded up to next cent, exemples:
    0,999 -> 1,00 || 1,000 -> 1,00 || 1,001 -> 1,01

    @ all: added a new jQuery function that should force update of chart fees after selecting the payment method, I can't test it with Bazar. Let me know!

    V 0.12 beta: http://www.sendspace.com/file/vr0hd5

  13. panosdotk
    Posted 2 years ago #

    I try v0.12 beta with Bazar ver 1.8.0 and it works if you select one page checkout. If I select the multistep checkout the fee is not updated.

  14. dekaru
    Posted 2 years ago #

    The auto-refresh option on the checkout page when changing payment methods now works, thanks! It also now sends the total amount, along with specifics, to the payment gateway (PayPal).

    However I still see the extra fee on the shopping cart page *before* actually setting any payment gateway


    I can see how this could be useful at some point, but right now it seems more like a bug rather than a feature. Is there something that can be done about it?


  15. belpha
    Posted 2 years ago #

    Try to clean your browser history (or use another browser / computer), I'm sure the information about (last) payment method is stored into browser's cache.

  16. dekaru
    Posted 2 years ago #

    You were absolutely right: the payment fees on the cart page reflect the payment method chosen on the checkout page. If I have two tabs open, changing the payment method reflects on the extra fees shown on the shopping cart page. I guess it sounds logical.

    Thank you ! You've been very helpful! You should definitely create a pull request in github so that mRova adds your functionality to this plugin :)

    Do you have a donate button anywhere? :)

  17. jayraaj.chavan
    Posted 2 years ago #

    Hello Belpha,

    Now it's working with Bazar Theme. Thanks a lot for your fast and kind support.

  18. belpha
    Posted 2 years ago #

    @ jayraaj, thanks for your feedback!

    @ dekaru, glad to help! I tried to contact the original author in several ways but never got any reply so I think that I'll start a fork version of this plugin in the near future.
    Oh thanks, but I don't have any donation button, if I'll ever come to Mexico City, you can pay me a beer ;)

    @ panosdotk, it seems that woocommerce doesn't support multistep checkout natively, as said here https://twitter.com/feios/status/291974130327228417
    If there is any demo/trial version of Bazar that I can install to make some test I'll give a try, I don't want to spend 60USD just for make a fix :P

  19. panosdotk
    Posted 2 years ago #

    hi belpha
    tonight I will prepare a demo installation especially for you. please send me your email to forward the login details.

  20. dekaru
    Posted 2 years ago #

    Thanks Belpha, I'll be glad to! Let us know when you fork it so we can follow :) Thanks again!

  21. belpha
    Posted 2 years ago #

    @ Panosdotk, I'm sorry but from tomorrow I will be out of city for a month! So I can get back on this only around half October...

  22. panosdotk
    Posted 2 years ago #

    @belpha. I have already setup the theme. Anytime you want please let me know

  23. panosdotk
    Posted 2 years ago #

    The extra payment not showing to email sent to customers. The total amount is correct but no extra charge row. Can anybody provide a solution to this.
    Thank you

  24. z4x3r
    Posted 2 years ago #

    Hello panosdotk

    It is been a long time since that feature has been requested but has not been developed. I'm starting to think that it is not as easy as It seems to be.

    Maybe we could organize for a pro developer to fix this and split the cost between everyone who wants the feature?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce Add Charges To Payment Gateway
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.