Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Add multiple product_ids to a snippet?

$
0
0

Replies: 0

Does anyone know how I can add multiple product ids to this snippet? Whenever I try to duplicate it my page breaks, so I guess I have no other option.

Here is the code:

add_filter( 'woocommerce_order_button_text', 'misha_custom_button_text_for_product' );
 
function misha_custom_button_text_for_product( $button_text ) {
 
	$product_id = 505; // a specific product ID you would like to check
 
	if( WC()->cart->find_product_in_cart( WC()->cart->generate_cart_id( $product_id ) ) ) {
		$button_text = 'New Button Text';
	}
 
	return $button_text;
 
}

Viewing all articles
Browse latest Browse all 59525

Trending Articles