fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Before add to cart button doesn’t work

Jailene Muler

I want to display the ‘Before add to cart button’ but doesn’t work, after a save the changes is still appearing after de cart button.

Hakik Zaman

Hi Jailene,

Thanks for reaching out to us. ‘Before add to cart button’ option depends on your theme.

I have added the Code Snippets plugin and added the below snippet to display swatches before add to cart.

add_action('woo_variation_swatches_pro_archive_page_loaded', function($wvs_pro){
   remove_action('woocommerce_init', array( $wvs_pro, 'enable_swatches' ), 1);
   add_action('woocommerce_after_shop_loop_item_title', array( $wvs_pro, 'after_shop_loop_item' ), 20);
}, 10, 1);

Thank You

Jailene Muler

Hello Hakik!

It works now on the shop page but on the single product page it still showing the swatches after de add cart button.

Hakik Zaman

Hi Jailene,

Can you please temporarily deactivate the swatches plugin?

Then check the default dropdown, is it displaying under the button?

Thank You

Jailene Muler

Hi Hakik,

I deactivated the swatches plugin and yes it is displaying under the button.

Hakik Zaman

Hi Jailene,

Please contact theme support to change the position.

The swatches will be displayed where your default dropdown displays.

Thank You