Home > Software engineering >  Woocommerce clear variations link moving add to cart button
Woocommerce clear variations link moving add to cart button

Time:04-29

I have removed the "clear" link from my theme's php file so that when a product variation is selected, the clear option doesn't show up. The link has now gone, which was part of the objective, but once a product variation is selected the "clear" link still has an effect on the add to cart button, making it move down about 30 pixels. I'm using the Variation Swatches for WooCommerce plugin to achieve the button look for the product variations. When not using the Variation Swatches plugin the clear link appears on the right hand side of the list, but when using the plugin the link appears below. Wish I could insert images here. Any help would be really appreciated. Thanks!

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

CodePudding user response:

Its not the price appearing once a variation is selected that's moving the button down?

Otherwise something to consider might be; the element that is the parent container for the clear link still appears in the html, the filter you added just replaces the inner html with an empty string. Since the parent container remains, it still takes up space on the page and may be moving other elements down. Have a look at the rendered html while you test selecting variations. Use Chrome dev tools to look at the html while you test.

  • Related