Actually it isn’t. I have good feeling how I could use custom template in the Shop page but I can’t figure out how I can make it dynamically. Like I said, in normal WordPress Pages if I echo out get_page_template(); it shows it’s template, page.php if default and custom if chosen. But if I make same check in WooCommerce page, it shows always only page.php no matter what.
Your URL’s talking about how to show templates for specific taxonomies.
This is all what I would like to do.
// If user has selected custom template
if( is_page_template( 'mycustomtemplate-for-shop-page.php ) ) {
echo 'Do something';
// If user use default template
} else {
echo 'Default';
}
But the problem is the output what WooCommerce pages give from get_page_template function, it’s always the same no matter what.
Product attributes are a taxonomy. From the original question it sounded like you wanted to display a different templates based on the attribute being viewed.
I think I understand what you mean now though. The WooCommerce shop page doesn’t use the page template system. The shop page becomes an archive – similar to how the posts page works.
You could use wc_get_page_id: https://github.com/woothemes/woocommerce/blob/master/includes/wc-page-functions.php#L46 to find the id of the page set to be the shop page. Then you can use get_post_meta to find the page template set on that page. I believe the meta is _wp_page_template.
Thank you for your help! I got it work.
Please could you explain…I want to edit my shop page (pull in a widget/sidebar at bottom) and can’t figure out how to do it. Editing the archive-product.php page doesn’t work..seems to be using something else but can’t figure out what.
Thanks