• Resolved msliwka

    (@msliwka)


    Hello, I need to get value of applied gift card in checkout cause I need to add conditional fee. How can I get this value? Is it an attribute of cart or session object? Please give me example of code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author pimwick

    (@pimwick)

    The session contains all of the gift card data and the redeemed amount is stored in the WooCommerce cart object.

    The redeemed amount is calculated after all totals are calculated. This means the true amount isn’t available until after fees have been taken into account. We use the ‘woocommerce_after_calculate_totals’ hook with a priority of 40 so if you want to hook in later than that to add fees you can recalculate.

    The redeemed amount is here:
    WC()->cart->pwgc_calculated_total

    You can review this file for more details about how the redeem process works:
    /pw-woocommerce-gift-cards/includes/pw-gift-cards-redeeming.php

    Plugin Author pimwick

    (@pimwick)

    Marking this as resolved, let us know if you need anything else. Best of luck with your store!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get gift card amount’ is closed to new replies.