Documentation

Add Custom Classes To The Variation Add To Cart Buttons

Some themes add custom classes to their catalog ‘add to cart’ buttons. If you’ve installed WooCommerce Show Single Variations, you may notice those buttons don’t have those classes applied. Fortunately, it’s easy to add them.

Using a tool like Code Snippets, add the following function:

/*
 * Add custom button class
 *
 * @param string $class
 *
 * @return string
 */
function iconic_button_class( $class ) {	
	$class .= ' your-custom-class';
	return $class;
}

add_filter( 'jck_wssv_add_to_cart_button_class', 'iconic_button_class', 10 );

This will append your-custom-class to the button classes. Note that there is space at the beginning of this custom class.

Are you using WooCommerce Show Single Variations yet?

Start your 14-day free trial right now and get instant access to the features described in this article.

or learn more

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.

WooCommerce Show Single Variations

WooCommerce Show Single Variations

Not got the plugin yet? Get instant access right now, free for 14 days.

or learn more

Still need help?

If you haven't found what you're looking for in our documentation, please contact support.

Get Support