Hi, thank you very much for your feedback and time,
No problem for the URL, how did you notice that one URL use the archive page and not the other ?
And the solution you provided is good but since the page is not full-width by default (we need a max-width because of products),
the header to will not take all the space available.
I found another way using hooks.
I used the articles you provided plus this one :
https://docs.woocommerce.com/document/conditional-tags/
add_action( 'astra_content_before', 'add_custom_header_on_woo_archives');
function add_custom_header_on_woo_archives() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$bg_image = get_term_meta( $cat->term_id, 'wpcf-category-background-image', true );
if ( $bg_image ) {
echo '<div style="background:url(' . $bg_image . ') no-repeat center;background-size:cover;width:100%;text-align:center;">';
echo '<h1 style="padding-top:4em;padding-bottom:4em;color:white;">'.$cat->name.'</h1>';
echo '</div>';
}
}
if ( is_shop() ) {
// define a default image and title
}
}
The only problem left is to get the correct image for shop page, I tried with this function
get_the_post_thumbnail_url();
but it returns the image of the first product, and not the featured image defined in shop page.
That code seems a good solution too.
Check the following code if it is working for your shop page:
wp_get_attachment_url( get_post_thumbnail_id( wc_get_page_id( 'shop' ) ) );
All right perfect!
It was the last missing piece.
My issue is resolved now. Thank you !
Awesome, I am glad I could help.
From you last message, you asked how did I knew that the archive page is using a Toolset template or not? I open the developers' tools in my browser and I check if the generated div/element has an ID of a template or not 😉