Home › Forums › Support › Apply php code only on single product page. This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by David. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts March 9, 2023 at 4:46 am #2561352 Jusung Hello. I have added php code, but one code break the cart page. I found a function is breaking the cart page. So, I need to apply the function only on single page. Is there any way to apply a code to a single page? I tried this, but not working function asfasdf() { if( is_product() ) { } } March 9, 2023 at 5:07 am #2561374 DavidStaff Customer Support Hi there, try this: add_action( 'wp', function(){ // do stuff on single product if ( is_product() ){ add_action( 'woocommerce_after_quantity_input_field', 'action_woocommerce_single_product_summary', 31, 0 ); } }); March 9, 2023 at 5:16 am #2561387 Jusung Thank you!!! It works well! March 9, 2023 at 5:24 am #2561395 DavidStaff Customer Support Glad to hear that! Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In