How to show custom plus and minus qty buttons on the cart page

// 1. Show plus minus buttons

add_action( ‘woocommerce_after_quantity_input_field’, ‘dandd_display_quantity_plus’ );

function dandd_display_quantity_plus() {
echo ‘<button type=”button” class=”plus” ><i class=”fa fa-angle-up”></i></button>’;
}

add_action( ‘woocommerce_before_quantity_input_field’, ‘dandd_display_quantity_minus’ );

function dandd_display_quantity_minus() {
echo ‘<button type=”button” class=”minus” ><i class=”fa fa-angle-down”></i></button>’;
}

// ————-
// 2. Trigger update quantity script

add_action( ‘wp_footer’, ‘dandd_add_cart_quantity_plus_minus’ );

function dandd_add_cart_quantity_plus_minus() {

if ( ! is_product() && ! is_cart() ) return;

wc_enqueue_js( ”

$(document).on(‘click’,’button.plus, button.minus’,function(e){
var qty = $( this ).parent( ‘.quantity’ ).find( ‘.qty’ );
var val = parseFloat(qty.val());
var max = parseFloat(qty.attr( ‘max’ ));
var min = parseFloat(qty.attr( ‘min’ ));
var step = parseFloat(qty.attr( ‘step’ ));

$(‘.woocommerce .actions button.button’).prop(‘disabled’, false);

if ( $( this ).is( ‘.plus’ ) ) {
if ( max && ( max <= val ) ) {
qty.val( max );
} else {
qty.val( val + step );
}
} else {
if ( min && ( min >= val ) ) {
qty.val( min );
} else if ( val > 1 ) {
qty.val( val – step );
}
}
});
” );
}