Merge pull request #4507 from thenbrent/cart-coupon-filters
Cart coupon filters
This commit is contained in:
commit
a53393e534
|
@ -186,13 +186,20 @@ function wc_cart_totals_coupon_html( $coupon ) {
|
|||
|
||||
$value = array();
|
||||
|
||||
if ( ! empty( WC()->cart->coupon_discount_amounts[ $coupon->code ] ) )
|
||||
$value[] = '-' . wc_price( WC()->cart->coupon_discount_amounts[ $coupon->code ] );
|
||||
if ( ! empty( WC()->cart->coupon_discount_amounts[ $coupon->code ] ) ) {
|
||||
$discount_html = '-' . wc_price( WC()->cart->coupon_discount_amounts[ $coupon->code ] );
|
||||
} else {
|
||||
$discount_html = '';
|
||||
}
|
||||
|
||||
$value[] = apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_html, $coupon );
|
||||
|
||||
if ( $coupon->enable_free_shipping() )
|
||||
$value[] = __( 'Free shipping coupon', 'woocommerce' );
|
||||
|
||||
echo implode( ', ', $value ) . ' <a href="' . add_query_arg( 'remove_coupon', $coupon->code, WC()->cart->get_cart_url() ) . '" class="woocommerce-remove-coupon">' . __( '[Remove]', 'woocommerce' ) . '</a>';
|
||||
$value = implode( ', ', $value ) . ' <a href="' . add_query_arg( 'remove_coupon', $coupon->code, WC()->cart->get_cart_url() ) . '" class="woocommerce-remove-coupon">' . __( '[Remove]', 'woocommerce' ) . '</a>';
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_totals_coupon_html', $value, $coupon );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue