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

Change coupon label of Woocommerce

Adding coupon removing icon to coupon label

function filter_woocommerce_cart_totals_coupon_label( $label, $coupon ) {
	$label .= '&emsp;<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 $label;
}
add_filter( 'woocommerce_cart_totals_coupon_label','filter_woocommerce_cart_totals_coupon_label', 10, 2 )

You may also like...