I have created a child theme to work alongside storefront and am struggling to customise the layout of the individual product pages.
Under single-product.php I was expecting to see html markup that I could manipulate but actually what is declared is this:
wc_get_template_part( 'content', 'single-product' );
With no access to the actual code…
Similarly, with my search bar, I need to add code to the individual product search results. But in search.php the following is declared:
get_template_part( 'loop' );
Again, forcing me to use JS and CSS to manipulate the appearance as best I can.
Please have a look at the get_template_part()
function: https://developer.wordpress.org/reference/functions/get_template_part/ and the woocommerce template structure: https://docs.woocommerce.com/document/template-structure/
With woocommerce you can edit template files in a update-safe way:
woocommerce
.content-single-product.php
.woocommerce
in your theme folder.In your search.php file you are loading a file called loop.php
which should be in your theme folder (wp-content/themes/yourtheme). Edit this file to do your changes. Maybe there is a subfolder in your theme called template-parts
or similar, depending on the theme you are using.