4

I am trying to override mini-cart.php which is template file located at woocommerce/cart/mini-cart.php. It should override behaviour of woocommerce widget cart but it isnt working. I can make any changes to the file but it looks like it is still loading from some other place and it is not overriden. I have also tried modifying core template files of woocommerce and deleting mini-cart.php from it but widget is still working. However mini-cart.php structure looks exactly the same as html structure generated in final. But it looks like woocommerce isnt using this file so it has probably changed by some update and mini-cart.php is just remain from later versions. Any ideas what file should I override to change look of widget cart?

I dont want to completely override whole core widget cart class because I just want to change one <span> to <p>.

Thanks in forward

closed as off-topic by Pieter Goosen, Rarst Jun 11 '14 at 10:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Add and remove an item, this will force the cart to purge it's html – Andrew Lazarus May 27 '15 at 9:12
0

Have you made sure to copy the mini-cart.php into yourtheme/woocommerce/cart/ not just yourtheme/woocommerce I can say for certain this works in Woocommerce version 2.0.12

Also if your saying that editing the core file isn't working is it possible that its getting override some where else in your theme. Could be worth searching your theme directory code for woocommerce_before_mini_cart seeing if thats used some where else.

  • my mini-cart.php is located in woocommerce/cart/ and I dont have any other files with woocommerce_before_mini_cart – horin Jul 30 '13 at 8:50
  • What version of woo are you using? And what theme, if not custom? – Mark Davidson Jul 30 '13 at 8:51
  • woo 2.0.1 and custom theme. Overriding every other theme files works great ... only mini-cart doesnt work – horin Jul 30 '13 at 8:53
  • One suggestion if not to much of a pain. Could you try changing themes to say Twenty Twelve and trying the override with that theme. Also try upgrading woo just eliminate the most obvious things. Seems incredibly strange that even editing the mini-cart.php in the woocommerce plugin does not work. Not possible you have another plugin thats being used for the cart ( know its probably not but worth a thought ). – Mark Davidson Jul 30 '13 at 8:59
  • shouldnt there docs.woothemes.com/wc-apidocs/… be something that is loading mini-cart.php? I cant see any code related to it there. – horin Jul 30 '13 at 8:59
13

I had this same problem. You must clear cache (or just delete cookies) before you will see your override. Not sure why :)

  • 13
    +1 -- the WooCommerce cart is saved in sessionStorage to avoid pulling a new copy on every page, so you need to clear your browser's sessionStorage to see any changes -- or just add another item to the cart, and it will be replaced. [and to the person who downvoted this: you get my downvote!] – webaware Dec 7 '13 at 21:45
2

As Mark Davidson said to over ride mini-cart.php you need to place it in a file that you have to name in your theme

yourtheme / woocommerce / cart / mini-cart.php

But you have to remember that for changes to take effect you need to go back into the widgets page of wp-admin and re-save the shopping cart widget each time you make a change or they will not show up.

Not the answer you're looking for? Browse other questions tagged or ask your own question.