Khandaker Toihidul Islam
Front-end Developer
React Js | Javascript | HTML | CSS | Bootstrap | Wordpress | PHP | Mysql

Change coupon amount html of wocommerce

Adding cross icon insteade of remove text

function filter_woocommerce_cart_totals_coupon_html( $coupon_html, $coupon, $discount_amount_html ) {
    // Change text
    $coupon_html =  ' <a href="' . esc_url( add_query_arg( 'remove_coupon', rawurlencode( $coupon->get_code() ), defined( 'WOOCOMMERCE_CHECKOUT' ) ? wc_get_checkout_url() : wc_get_cart_url() ) ) . '" class="woocommerce-remove-coupon" data-coupon="' . esc_attr( $coupon->get_code() ) . '">' . __( "<i class='fa fa-remove'></i>", 'woocommerce' ) . '</a>'.$discount_amount_html;

    return $coupon_html;
}
add_filter( 'woocommerce_cart_totals_coupon_html','filter_woocommerce_cart_totals_coupon_html', 10, 3 );

You may also like...