Skip to content
OSULZER.AT
General1 min read· updated February 14, 2026

Ultimate Gift Cards for WooCommerce: Automatically Apply Tax Calculation When a Gift Card Is Redeemed

Ultimate Gift Cards for WooCommerce and Germanized do not apply tax when a gift card is redeemed. This snippet moves the tax calculation to the redemption.

This small snippet came out of a problem with the tax calculation for value vouchers created through the WooCommerce plugin “Ultimate Gift Cards for WooCommerce” and Germanized. Because of the way the two plugins handle coupons, it was not possible to apply the tax calculation at the time of redemption. The only option was to deduct the tax from the sold voucher during payment, which is of course not ideal if you sell products from several tax classes. If you use the combination of both plugins described above in your shop, the snippet solves the problem.

Are you looking for a professional online shop or do you need help from a specialist? Get in touch with me! You can find more about my services for online shops here. Online shop development in Vienna - OSULZER.AT

/**
 *
 *  Set the bought coupon to apply tax when redeemed
 * @param $order_id
 * @param $item_id
 * @param $new_coupon_id
 * @param $product_id
 * @return void
 */
 
function osu_setCouponBeforeTax( $order_id, $item_id, $new_coupon_id, $product_id ) {

    // Load the coupon object
    $coupon = new WC_Coupon($new_coupon_id);
    update_post_meta($new_coupon_id, 'is_voucher', 'yes');

}

add_action('wps_wgm_set_coupon_meta_for_product_as_a_gift', 'osu_setCouponBeforeTax', 1, 4 );

Learn more about my services as a WooCommerce developer.

WooCommerce Development

Prefer to have it done for you?

Custom plugins, integrations, and B2B features for your shop - €120/h plus VAT.

See WooCommerce development

New project?

Contact.

Tell me briefly about your project - I'll get back to you personally.

Your data is used solely to handle your inquiry. More in the privacy policy.