WP Menu Cart Pro comes with a micro-templating engine that allows for advanced customization of the menu cart item and the submenu.
This template is located in the plugin folder (wp-menu-cart-pro
) under templates/menucart-item.html
To override the template, you can copy this template to your (child) theme:wp-content/themes/YOURTHEME/woocommerce/wp-menu-cart/
Note that not all themes have a /woocommerce
folder, so if yours doesn’t have it, you will need to create that too.
If you want to use PHP, we recommend renaming this file to .php (menucart-item.php
). The template uses a system of tags/placeholders that are dynamically filled with the data, but with PHP you can also override this completely and add your own cart logic. Here’s an example of how to get the cart data in WooCommerce:
<?php if ( ! WC()->cart->is_empty() ) : ?> <ul class="{{submenu_ul_class}}" style="{{submenu_ul_style}}"> <?php foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { # build your custom output here } ?> </ul> <?php endif; ?>
For some examples of code that you can use for WooCommerce, take a look at the mini-cart.php template that is used for the Cart widget.
CSS is most easily entered either in the Advanced tab of the plugin settings or in your theme CSS stylesheet.