This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Solution to Display Woocommerce Shop Page Content

8 years ago · Last reply by Alex S 8 years ago

I spent an hour trying to output siteorigin page content for Woocommerce shop page. By default Woo shop page is a product archive page and it doesn’t go through the_content filter. Here is the hack to display the content set in the shop page.

By default Woo shop page uses the woocommerce/archive-product.php template and the hook “woocommerce_product_archive_description” displays the actual content without going through any filters. It gets the content directly from the database. You can basically override the Woo function “woocommerce_product_archive_description” which renders the content in your functions.php. Then I went to the siteorigin-panels.php and copied partial of the “generate_post_content” function that renders the saved post meta content.

First get the shop page ID then get its siteorigin post meta and pass it to the render function. That’s it. I’m hoping SiteOrigin will extract the render function as its own function then we can call it easily in the future. Best. Leo

function woocommerce_product_archive_description() {
// Don’t display the description on search results page
if ( is_search() ) {
return;
}

if ( is_post_type_archive( ‘product’ ) && 0 === absint( get_query_var( ‘paged’ ) ) ) {

$shop_page_id = wc_get_page_id( ‘shop’ );

// copied from siteorigin-panels.php
if ( get_post_meta( $shop_page_id, ‘panels_data’, true ) ) {
$panel_content = SiteOrigin_Panels::renderer()->render(
$shop_page_id,
// Add CSS if this is not the main single post, this is handled by add_single_css
$shop_page_id !== get_queried_object_id()
);

if ( ! empty( $panel_content ) ) {
echo $panel_content;
}
}
// end siteorigin-panels.php
}
}

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Alex S Staff 8 years, 8 months ago

    Hi Leo,

    Thank you for the contribution. Consider submitting a pull request to the SiteOrigin Page Builder GitHub.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread