Home » WooCommerce: Remove “Clear” Button @ Variable Product Page

WooCommerce: Remove “Clear” Button @ Variable Product Page

by adminkys

As soon as you select a product attribute (by default, this is a dropdown right above the variation add to cart button), a “Clear” button appears beside the dropdown/s in order to reset the selection/s and start anew.

As usual, some WooCommerce store owners may require to hide/delete such link, and this is why your truly is here: why “display:none” stuff with CSS when you’re not actually removing it completely from the code? Which means, there must be a PHP way.

And, once again, here comes a 1-line snippet. Enjoy!

When you select an attribute (“Color” in the example), a “Clear” link appears beside the last dropdown. On click, it resets all select fields. In this snippet, we’ll see how to completely remove this element.

PHP Snippet: Remove Reset Variations Link @ Variable Product Page

 * @snippet       Hide Clear Link | WooCommerce Variable Products
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 6
 * @donate $9     https://www.tutoraspire.com

add_filter( 'woocommerce_reset_variations_link', '__return_empty_string', 9999 );

You may also like