From 13bc235020ee2058931298c50e657ec0ce8bb808 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 26 Apr 2017 13:25:14 +0100 Subject: [PATCH] Bump template version and move to correct function files. --- includes/wc-cart-functions.php | 14 -------------- includes/wc-template-functions.php | 9 +++++++++ includes/wc-template-hooks.php | 1 + templates/cart/cart-empty.php | 11 ++++++----- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index 824a793f087..75ceb474a24 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -40,20 +40,6 @@ function wc_empty_cart() { WC()->cart->empty_cart( false ); } -/** - * Show notice if cart is empty. - * - * @since 3.1.0 - */ -function wc_empty_cart_message() { - ?> -

- -

- ' . apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) . '

'; +} diff --git a/includes/wc-template-hooks.php b/includes/wc-template-hooks.php index 4138c2a7a64..6ef4c801061 100644 --- a/includes/wc-template-hooks.php +++ b/includes/wc-template-hooks.php @@ -228,6 +228,7 @@ add_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shop add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); add_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 ); add_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); +add_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 ); /** * Footer. diff --git a/templates/cart/cart-empty.php b/templates/cart/cart-empty.php index aeb778dc219..d0a37915d66 100644 --- a/templates/cart/cart-empty.php +++ b/templates/cart/cart-empty.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.0.0 + * @version 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,11 +22,12 @@ if ( ! defined( 'ABSPATH' ) ) { wc_print_notices(); -?> +/** + * @hooked wc_empty_cart_message - 10 + */ +do_action( 'woocommerce_cart_is_empty' ); - - - 0 ) : ?> +if ( wc_get_page_id( 'shop' ) > 0 ) : ?>