Change template in product archive
-
Hello
Please tell me where I can change or create a new template for the product archive (see screenshot 1) .
Theme settings – Product archive – Product styles
I added a new field “my_description” to the product (see screenshot 2) and would like to display this field in the product archive through a different template.
Attachments:
You must be
logged in to view attached files.
Hello,
Sorry, but these custom fields functionality is not related to the theme so most likely it can not work properly.
You can set the “Show summary on hover” product style that shows a product description so you can define this as a description and it will show on each archive page.
https://prnt.sc/Ug-eEFBtsAqr
Kind Regards
Hello
I solved the issue by editing the template /wp-content/themes/woodmart-child/woocommerce/content-product-alt.php
Sample copied from parent theme
Created 2 parameters in the product “my_title” and “my_description”
https://prnt.sc/Y-yjyy0a5ibo
In the template got them through the code
$my_desc = get_post_meta(get_the_ID(),'my_description',true)?:'';
$my_title = get_post_meta(get_the_ID(),'my_title',true)?:'';
Wrote the code, if “my_title” and “my_description” are set, then display them instead of the usual code
Result
https://prnt.sc/wmj_OL6Ty7cD
Hello,
Glad that you sorted it out.
Always remember that you can reach out to us with any questions you may have.
We wish you a splendid day!
Kind Regards
The topic ‘Change template in product archive’ is closed to new replies.