D
D
denism3002018-10-08 20:51:54
WordPress
denism300, 2018-10-08 20:51:54

How to override WooCommerce cart widget template?

Trying to override the cart widget template to edit it.
I do this:
1. I copied the mini-cart.php file to my_theme/woocommerce/cart folder, made changes
2. I added the following code to functions.php:

if(!function_exists('woocommerce_mini_cart')) {
  function woocommerce_mini_cart($args = array()) {
    $defaults = array(
      'list_class' => ''
    );
    $args = wp_parse_args($args, $defaults);
    wc_get_template(get_stylesheet_directory_uri() . '/woocommerce/cart/mini-cart.php', $args);
  }
}

however, the template is not overridden

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question