Ask your WordPress questions! Pay money and get answers fast! (more info)

Make WC cart/coupon fix work again

Hi

I posted this before:

http://wpquestions.com/question/showChrono/id/18307

I got it to work by adding this code to functions.php



/* START MAKE COUPON UPDATE WITHOUT JS */

function md_woo_no_coupon_js() {

wp_print_scripts( 'jquery' );

?>

<script type='text/javascript'>

jQuery( document ).ready( function( $ ) {

$( '.woocommerce-remove-coupon' ).off();

$( 'form.checkout_coupon' ).off();

} );

</script>

<?php

}

add_action( 'wp_footer', 'md_woo_no_coupon_js', 999 );

function md_woo_no_coupon_remove_js( $html ) {

return str_replace( 'woocommerce-remove-coupon', '', $html );

}

add_filter( 'woocommerce_cart_totals_coupon_html', 'md_woo_no_coupon_remove_js' );

/* END MAKE COUPON UPDATE WITHOUT JS */


function rem_hide_coupon(){

if(WC()->cart->applied_coupons && is_checkout()){

?>

<script type='text/javascript'>

jQuery( document ).ready( function( ) {

jQuery( 'form.checkout_coupon' ).attr('style','display:none!important');

} );

</script>

<?php

}

}

add_action( 'wp_footer', 'rem_hide_coupon', 99 );



But now I have installed it on a fresh install.. and it doesn't work on that.

http://july.maybeauty.co.uk/shop/

please use the coupon: foki

Answers (2)

2016-08-09

Rempty answers:

I don't see the coupon form in the checkout, are you using the default template files?
Or you want to modify the coupon in the cart page


FirstEntertainment comments:

I want to modify on the cart page. Checkout page will not have the coupon field.

2016-08-09

Arnav Joy answers:

are you using different version of woocommerce ?


FirstEntertainment comments:

Yes. Now I use WooCommerce 2.6.4 = the latest one.

Old store uses 2.5.5.

Hmm. I'm gonna test the cart a bit more.. actually they might have fixed that problem that wanted me to fix this in the first place.