Mini cart
-
Hello, i am using the mini cart gutenberg block, and i notice that my mini cart disappears on cart/checkout page. How can i disable this, i want to be visible all the time
-
Hi,
It seems like you’re facing an issue with the visibility of the mini cart in WooCommerce when you’re on the cart or checkout page. By default, WooCommerce usually hides the mini cart on the cart and checkout pages to avoid redundancy since customers are already on those specific pages to review and complete their orders.
However, if you want to keep the mini cart visible on these pages, you can do so by customizing your WordPress theme or by using custom CSS. Here’s how you can achieve this:
Method 1: Use Custom CSS
- Go to your WordPress dashboard.
- Navigate to “Appearance” > “Customize.”
In the Customizer, you can add custom CSS to override the default behavior. Here’s a CSS snippet that you can use to make the mini cart visible on the cart and checkout pages:
/* Show mini cart on cart and checkout pages */ .woocommerce-cart .widget_shopping_cart, .woocommerce-checkout .widget_shopping_cart { display: block !important; }
This CSS rule will override the default display settings and force the mini cart to be visible on the cart and checkout pages. After adding this CSS, publish your changes.
Method 2: Theme Customization
If you prefer a more robust solution, you can edit your theme’s template files to control the display of the mini cart. Keep in mind that this method may require some coding knowledge.
Here are the steps:
- Create a Child Theme (if not already using one): It’s always a good practice to create a child theme before making any changes to your theme’s template files. This way, your changes won’t be lost when you update your theme. You can find instructions on creating a child theme in the WordPress Codex.
- Locate the Mini Cart Template: The mini cart is typically controlled by a template file in your theme. The file might be named
mini-cart.php
or something similar. You can check your theme’s folder for this file. - Modify the Template File: Open the
mini-cart.php
file in your child theme if you’re using one or in your main theme if not. Find the code that controls the visibility of the mini cart and comment it out or modify it to always display the mini cart. - Save Changes: After editing the template file, save your changes.
- Clear Cache: If you’re using a caching plugin, clear the cache to ensure your changes take effect.
Please note that editing theme files directly can be risky, and it’s crucial to make a backup before doing so. Additionally, keep in mind that modifying theme files directly might affect the responsiveness and compatibility of your theme.
Always exercise caution when making changes to your website’s code, and consider seeking assistance from a developer if you’re unsure about any aspect of the process.
Hi,
thank you for the response. I have tried the first method but it doesn’t work! I iam using generatepress theme, and i couldnt find any mini cart template, the only template i can see is yours in woocommerce/templates/cart/mini-cart.php
Hi @samina04
The mini-cart.php file is indeed located in the WooCommerce templates folder, but it’s not directly editable from the theme. To customize it, you’ll need to copy it to your theme’s folder, maintaining the same directory structure.
Here are the steps:
- Copy the mini-cart.php file from woocommerce/templates/cart/ to your theme’s folder. The resulting path should look like this: your-theme/woocommerce/cart/mini-cart.php.
- Now you can edit the mini-cart.php file within your theme’s directory.
Check out our detailed guide here to learn more about template overriding: https://woocommerce.com/document/template-structure/#how-to-edit-files
Please remember to not edit these files within the core plugin itself as they are overwritten during the upgrade process, and any customizations will be lost.
If you’re still experiencing difficulties, please let us know. We’re here to help.
Hello,
which line in mini-cart.php i have to edit in order to not hide the mini cart on cart/checkout pages ?
Hello @samina04,
which line in mini-cart.php i have to edit in order to not hide the mini cart on cart/checkout pages ?
The
mini-cart.php
template is for the legacy cart widget so I’m afraid this won’t work for the Gutenberg block.
I suggest submitting this as a feature request in the plugin development repository: https://github.com/woocommerce/woocommerce-blocks/issues/new/choose
Your feedback is always appreciated! :?)Additionally, it’s important to note that WooCommerce blocks operate differently from the default WooCommerce templates. If you’re interested in building a custom solution to force render the block?kindly refer to this section of the development repository. If you need assistance from a developer,?please check our list of trusted WooExpert agencies. ??
Hope this helps!
- The topic ‘Mini cart’ is closed to new replies.