Empty cart HTML contents
-
Hello,
This question already asked by several users, but I want to suggest a workaround for this problem. Since the message returned by get_refreshed_fragments AJAX request when default mini-cart template is used did not changed since WooCommerce 3.1.0, the following code can be used to solve the problem:if( optimocha_getCookie("woocommerce_cart_hash") ) { ... } else { addEventListener("DOMContentLoaded", function() { if (shopping_carts = document.querySelectorAll("div.widget_shopping_cart_content")) { shopping_carts.forEach(function(cart_content) { cart_content.innerHTML = "<p class=\\"woocommerce-mini-cart__empty-message\\">' . esc_html__( 'No products in the cart.', 'woocommerce' ) . '</p>"; }); } }); }
An option to use or do not use this code can be added to the WP admin interface.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Empty cart HTML contents’ is closed to new replies.