• Resolved popeating

    (@popeating)


    I have a dropdown in checkout page, based on the dropdown value, it will recalculate additional fee; on checkout page the additional fee is displayed correctly and added to total, but when i place order, the order itself does not have the additional fee.
    just for debug i printed
    WC()->session->get(‘cart_totals’)
    just before checkout, and it shows that the fee and totals looks correct, but then it disappear (no fee in thank you page, no fee in order, no fee in emails)
    any suggestion?

    • This topic was modified 5 years, 7 months ago by popeating.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    Hi @popeating

    How are you adding the additional fee? Is it custom coding or a plugin?

    Thread Starter popeating

    (@popeating)

    I was coding a plugin but i did not realize (since i did not read the first line of documentation about it!) that
    woocommerce_cart_calculate_fees
    is called everytime (at least everytime the fee is needed) and its recent value is not persisted, so when on checkout page, it was called and all the calculation (made on values from checkout page itself) was correct; but once the order is submitted it was called again, but this time there were no values to calculate the fee, so it was returned at 0.
    I solved it storing the most recent value of additional fee calculated by chockout page in session and reading it from the session when placing the order.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Additional fee not stored in order’ is closed to new replies.