“Add to cart” different versions

[ad_1]

Hi there,

Thanks for contacting WooCommerce support.

To clarify, what type of customization are you trying to accomplish?

It looks like you wanted the text to be the same as the default text. If you’re trying to customize the appearance of the buttons. I’d suggest using CSS.

If you’d like to change the button text, I’d suggest using a different filter. This way you can check the product type before displaying a different text:

add_filter( 'woocommerce_product_add_to_cart_text', 'change_add_to_cart_text', 10, 1 );

function change_add_to_cart_text( $default ) {
	global $product;
	$product_type = $product->get_type();
	if ( 'simple' === $product_type ) {
		$default = 'Add to cart';
	} else if ( 'variable' === $product_type ) {
		$default = 'Select options';
	}

	return $default;
}

Hi thanks for the reply!

We sell some items by weight and some items by each. So having the add to cart for all items was a little confusing. This is exactly what i was looking for. Thank you!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer