From 3ab6acc4951d6acbd38cc9ad58186110d44897e1 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 21 Feb 2014 15:16:43 +0000 Subject: [PATCH] wc_cart_totals_coupon_label function and filter to override coupon labels --- includes/wc-cart-functions.php | 14 ++++++++++++++ templates/cart/cart-totals.php | 4 ++-- templates/checkout/review-order.php | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index b60c74147d3..ee6eb858878 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -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 * diff --git a/templates/cart/cart-totals.php b/templates/cart/cart-totals.php index 1b3a76f9b34..ffe2439b07e 100644 --- a/templates/cart/cart-totals.php +++ b/templates/cart/cart-totals.php @@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly cart->get_coupons( 'cart' ) as $code => $coupon ) : ?> - + @@ -64,7 +64,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly cart->get_coupons( 'order' ) as $code => $coupon ) : ?> - + diff --git a/templates/checkout/review-order.php b/templates/checkout/review-order.php index 4dbea632d77..882fac72c6c 100644 --- a/templates/checkout/review-order.php +++ b/templates/checkout/review-order.php @@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly cart->get_coupons( 'cart' ) as $code => $coupon ) : ?> - + @@ -68,7 +68,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly cart->get_coupons( 'order' ) as $code => $coupon ) : ?> - +