I am trying to remove the shopping cart from the parents theme via the child theme's functions.php file. I could easily remove it from the parent's functions.php but we all know that is a no-no. Besides, the option to put it back should be available in the future. Unfortunately, the parent theme MAXSTORE was customized so a generic remove from woocommerce doesn't work. I have to hack the functions in MAXSTORE parent. But, I am not really that good at this. Can anyone show me how to do this?
p.s. Don't worry about the wishlist part. The theme config had a handy dandy checkbox to control its visibility ;)
Here is the function in question from the parent functions.php
////////////////////////////////////////////////////////////////////
// WooCommerce header cart
////////////////////////////////////////////////////////////////////
if ( !function_exists( 'maxstore_cart_link' ) ) {
function maxstore_cart_link() {
?>
<a class="cart-contents text-right" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php _e( 'View your shopping cart', 'maxstore' ); ?>">
<i class="fa fa-shopping-cart">
<span class="count"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
</i>
<span class="amount-title hidden-sm hidden-xs"><?php echo _e( 'Cart ', 'maxstore' ); ?></span>
<span class="amount-cart"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span>
</a>
<?php
}
}
if ( !function_exists( 'maxstore_head_wishlist' ) ) {
function maxstore_head_wishlist() {
if ( function_exists( 'YITH_WCWL' ) ) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<div class="top-wishlist text-right">
<a href="<?php echo esc_url( $wishlist_url ); ?>" title="Wishlist" data-toggle="tooltip">
<i class="fa fa-heart"><div class="count"><span><?php echo yith_wcwl_count_products(); ?></span></div></i>
</a>
</div>
<?php
}
}
}
add_action( 'wp_ajax_yith_wcwl_update_single_product_list', 'maxstore_head_wishlist' );
add_action( 'wp_ajax_nopriv_yith_wcwl_update_single_product_list', 'maxstore_head_wishlist' );
if ( !function_exists( 'maxstore_header_cart' ) ) {
function maxstore_header_cart() {
?>
<div class="header-cart-inner">
<?php maxstore_cart_link(); ?>
<ul class="site-header-cart menu list-unstyled">
<li>
<?php the_widget( 'WC_Widget_Cart', 'title=' ); ?>
</li>
</ul>
</div>
<?php
if ( get_theme_mod( 'wishlist-top-icon', 0 ) != 0 ) {
echo maxstore_head_wishlist();
}
?>
<?php
}
}
if ( !function_exists( 'maxstore_header_add_to_cart_fragment' ) ) {
add_filter( 'woocommerce_add_to_cart_fragments', 'maxstore_header_add_to_cart_fragment' );
function maxstore_header_add_to_cart_fragment( $fragments ) {
ob_start();
maxstore_cart_link();
$fragments[ 'a.cart-contents' ] = ob_get_clean();
return $fragments;
}
}
////////////////////////////////////////////////////////////////////
EDIT
Being the front-end developer that I am, I managed to do it with CSS. A good solution, but not what I want and not what I asked so I won't answer my own question, instead I'll post it here for others to consider it
li#wpmenucartli {
display: none; //hides the menu cart list item
}
.navbar-inverse .navbar-nav > li:nth-last-child(2) > a:after {
content: ''; //gets rid of the trailing dash on the second to last list item to pretend it is the actual last item
border-right:none; //if you have a border, this does the same as above
}
Thank you in advance