Merge pull request #5172 from BFTrick/free-ship-coupon
An Extra Comma Appears When Using A Coupon That Gives Free Shipping
This commit is contained in:
commit
bf30244791
|
@ -191,8 +191,9 @@ function wc_cart_totals_coupon_label( $coupon ) {
|
|||
* @return void
|
||||
*/
|
||||
function wc_cart_totals_coupon_html( $coupon ) {
|
||||
if ( is_string( $coupon ) )
|
||||
if ( is_string( $coupon ) ) {
|
||||
$coupon = new WC_Coupon( $coupon );
|
||||
}
|
||||
|
||||
$value = array();
|
||||
|
||||
|
@ -204,8 +205,12 @@ function wc_cart_totals_coupon_html( $coupon ) {
|
|||
|
||||
$value[] = apply_filters( 'woocommerce_coupon_discount_amount_html', $discount_html, $coupon );
|
||||
|
||||
if ( $coupon->enable_free_shipping() )
|
||||
if ( $coupon->enable_free_shipping() ) {
|
||||
$value[] = __( 'Free shipping coupon', 'woocommerce' );
|
||||
}
|
||||
|
||||
// get rid of empty array elements
|
||||
$value = array_filter( $value );
|
||||
|
||||
$value = implode( ', ', $value ) . ' <a href="' . add_query_arg( 'remove_coupon', $coupon->code, WC()->cart->get_cart_url() ) . '" class="woocommerce-remove-coupon">' . __( '[Remove]', 'woocommerce' ) . '</a>';
|
||||
|
||||
|
|
Loading…
Reference in New Issue