wc_cart_totals_coupon_label function and filter to override coupon labels
This commit is contained in:
parent
9f5ebda756
commit
3ab6acc495
|
@ -169,6 +169,20 @@ function wc_cart_totals_shipping_html() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a coupon label
|
||||
*
|
||||
* @access public
|
||||
* @param string $coupon
|
||||
* @return void
|
||||
*/
|
||||
function wc_cart_totals_coupon_label( $coupon ) {
|
||||
if ( is_string( $coupon ) )
|
||||
$coupon = new WC_Coupon( $coupon );
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_totals_coupon_label', esc_html( __( 'Coupon:', 'woocommerce' ) . ' ' . $coupon->code ), $coupon );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a coupon value
|
||||
*
|
||||
|
|
|
@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?>
|
||||
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php _e( 'Coupon:', 'woocommerce' ); ?> <?php echo esc_html( $code ); ?></th>
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
@ -64,7 +64,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?>
|
||||
<tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php _e( 'Coupon:', 'woocommerce' ); ?> <?php echo esc_html( $code ); ?></th>
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?>
|
||||
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php _e( 'Coupon:', 'woocommerce' ); ?> <?php echo esc_html( $code ); ?></th>
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
@ -68,7 +68,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?>
|
||||
<tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php _e( 'Coupon:', 'woocommerce' ); ?> <?php echo esc_html( $code ); ?></th>
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
|
Loading…
Reference in New Issue