Patrik Zackrisson
Patrik Zackrisson

Reputation: 64

remove woocommerce link when cart is empty

I have a problem to remove the link to the shop.

i dont want a link to the shop when the cart is empty.

Here is the original template file:

<?php
/**
 * Empty cart page
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

?>

<p><?php _e( 'Your cart is currently empty.', 'woocommerce' ) ?></p>

<?php do_action('woocommerce_cart_is_empty'); ?>

<p><a class="button" href="<?php echo get_permalink(woocommerce_get_page_id('shop')); ?>"><?php _e( '&larr; Return To Shop', 'woocommerce' ) ?></a></p>

So i have tryed this in function.php whit out any luck:

remove_action('woocommerce','woocommerce_cart_is_empty');

Upvotes: 0

Views: 2843

Answers (2)

Roald D
Roald D

Reputation: 86

The answer by Howlin is correct, but you shouldn't edit the file in the woocommerce plugin folder. You should copy the specific template file from woocommerce to your own theme directory and edit that file. Removing the link in the copied file will create the same effect as your desired filter.

Upvotes: 2

Howli
Howli

Reputation: 12469

Removing

<p class="return-to-shop"><a class="button wc-backward" href="<?php echo apply_filters( 'woocommerce_return_to_shop_redirect', get_permalink( wc_get_page_id( 'shop' ) ) ); ?>"><?php _e( 'Return To Shop', 'woocommerce' ) ?></a></p>

from the cart-page.php page, should do it.

Upvotes: 0

Related Questions