• Hello,

    I was using $cart->add_fee to add discount (based on custom logic). After enabling plugin it stopped working.
    Adding discount is hooked with add_action('woocommerce_before_calculate_totals', 'discount_based_on_trade_account');.

    Any tip how to get it working back is appreciated

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi.
    You need debug step by step to get exactly bug. In this plugin, we don’t use woocommerce_before_calculate_totals hook.

    Thread Starter robertadchitects

    (@robertadchitects)

    Hi,
    Isn’t it exactly bug? $cart->add_fee worked and stopped working after activating plugin. Is there any information I can share with you that would be helpful in troubleshooting?

    No, I want to know bug in which line, type of bug,… Are you web developer? Do you use some debug tools like Query monitor plugin?

    Thread Starter robertadchitects

    (@robertadchitects)

    The problem is that there is no bug/warning appearing. The only effect is that coupon is not applied.

    I’m a developer. I’ve used Query monitor but it showed no errors.
    When I’ve added var_dump($cart) just before $cart->add_fee there are warnings Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/fieldtiles/wp-content/themes/fieldtiles/inc/functions_coupon.php:43). Do you think is somehow related?

    Are there any actions I could perform to obtain more information that would be helpful?

    No, this warning mean you show data in header area. I think line-43 is where you write var_dump().

    To difficult to help you when I don’t know your code.

    Thread Starter robertadchitects

    (@robertadchitects)

    Yes, line-43 is where I wrote it. I was asking because this warning appears only when plugin is activated.

    Here’s the code: https://bitbucket.org/robert-adchitects/field-tiles-discount/src/master/functions_coupon.php

    Currently, this function is not exist, may be you don’t send all code https://prnt.sc/t1srr2

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Conflict with “add_fee” function – unable to add discount’ is closed to new replies.