Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove the reset variation button on WooCommerce variable products

On variable products, I would like to remove the reset variation button that appears on my WooCommerce product page when selecting variations (ex. Size, colour), that allows to reset all the choices that have been made.

This pop-up, even when not displayed yet, modifies the display of the Variation tab. Last variation tab is not aligned with the other tabs (because some space is needed for the pop-up to appear).

What should I do to not call this function at all (so no space is needed for the pop-up and the variation tabs display correctly) ?

I've tried to make it invisible, but it is not enough. I would like to not call it at all.

<a class="reset_variations" href="#" style="visibility: visible; display: block;">Reset</a>

On the "click" event a javascript is called.

I expect the javascript not to be called so that the variation tab displays correctly.

like image 385
Olivier Chambault Avatar asked Apr 08 '19 15:04

Olivier Chambault


1 Answers

The following will disable the reset variation button on variable products:

add_filter('woocommerce_reset_variations_link', '__return_empty_string');

Code goes in function.php file of your active child theme (or active theme). Tested and works.

like image 107
LoicTheAztec Avatar answered Nov 07 '22 04:11

LoicTheAztec