Merge branch 'pr/14612'

This commit is contained in:
Mike Jolley 2017-04-26 13:26:26 +01:00
commit 13a610d1d8
3 changed files with 16 additions and 9 deletions

View File

@ -2576,3 +2576,12 @@ function wc_logout_url( $redirect = '' ) {
return wp_logout_url( $redirect );
}
}
/**
* Show notice if cart is empty.
*
* @since 3.1.0
*/
function wc_empty_cart_message() {
echo '<p class="cart-empty">' . apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) . '</p>';
}

View File

@ -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.

View File

@ -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,15 +22,12 @@ if ( ! defined( 'ABSPATH' ) ) {
wc_print_notices();
?>
/**
* @hooked wc_empty_cart_message - 10
*/
do_action( 'woocommerce_cart_is_empty' );
<p class="cart-empty">
<?php _e( 'Your cart is currently empty.', 'woocommerce' ) ?>
</p>
<?php do_action( 'woocommerce_cart_is_empty' ); ?>
<?php if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
<p class="return-to-shop">
<a class="button wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
<?php _e( 'Return to shop', 'woocommerce' ) ?>