1

I am customizing my product detail page. I put the code before the single product summary in content-single-product.php

As you can see here: Link to product page

But i want it like this:

enter image description here

Can some one tell me where i have to put the code to place it outside the woocommerce container?

Thanks,

Chiel

2 Answers 2

0

You can try adding php in index.php file in your theme folder after get_header() is called.Your php block will come after header and before woo commerce content.

1
  • yes this is correct. Commented Nov 25, 2019 at 9:48
0

The function responsible for opening WooCommerce content wrapper is attached to woocommerce_before_main_content action hook with priority 10.

You can wrap your code into function and attach it to that hook with priority less than 10.

add_action( 'woocommerce_before_main_content', 'se337291_before_content_wrapper');
function se337291_before_content_wrapper()
{
   // display something only on single product page
   if ( ! is_product() ) 
      return;
   //
   // your code here...
   //
}

Another option is to copy the single-product.php file to the theme directory and modify it. Here you will find information on how to overwrite templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.