Woocommerce single product page add Buy Now Button with specific url

I use following snippet for wordpress site add_action( ‘woocommerce_single_product_summary’, ‘my_funtion_sample’, 30 ); function my_funtion_sample() { global $product; $targeted_products = array( 3345 ); if( in_array( $product->get_id(), $targeted_products ) ) echo ‘<a href=”https://example.com/product-3345-checkout/” class=”button btn”>Buy Now</a>’; } this works for product id 3345. but when it comes to another product like product id 4012. when i click…

Details