Description: Click button – Clear all products in Cart Page
#1. First, you need to use this code to Custom CSS box
span.clear-products { position: fixed; top: 50%; right: 0; transform: translateY(-50%); background-color: #000; color: #fff; padding: 5px 10px; border-radius: 10px; z-index: 9999; cursor: pointer; display: none; } body#cart span.clear-products { display: block !important; }
#2. Next, use this code to Code Injection > Footer
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <span class="clear-products">Clear Products</span> <script> $(document).ready(function() { $('.clear-products').on('click', function() { if ($('button.cart-row-remove').length > 0) { $('button.cart-row-remove').each(function() { $(this)[0].click(); }); } setTimeout(function() { location.reload(); }, 1000); }); }); </script>
#3. Result
When users click “Clear Products“, it will clear all products and reload Cart Page.