I want to create another shop page for testing purpose which is an exact copy of the woocommerce shop page. The shop page is set in woocommerce settings under products tab. To duplicate it, I created a template and added the code
wc_get_template('archive-product.php');
But it does not display anything. It does not go past this if block
if ( wc_get_loop_prop( 'total' ) ) {
What is wrong here?
The archive template product is here
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.4.0
*/
defined( 'ABSPATH' ) || exit;
get_header( 'shop' ); ?>
<?php
if ( woocommerce_product_loop() ) {
echo '<div class="width-setter">';
_e( '<h1 class="page-title">choose your subscription</h1>', 'tmc' );
//woocommerce_output_all_notices();
echo '</div>';
echo '<div class="subscription-tabs">';
echo '<ul class="sub-tab-labels width-setter">';
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
do_action( 'woocommerce_shop_loop' ); ?>
<?php if( get_post_field( 'post_name') != 'subscription' ) { ?>
<li>
<a href="#tab-<?php echo get_the_ID(); ?>">
<span><?php echo get_the_title(); ?></span>
<img src="<?php echo get_the_post_thumbnail_url(); ?>" alt="">
</a>
</li>
<?php }
}
}
echo '</ul>';
woocommerce_product_loop_start();
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
do_action( 'woocommerce_shop_loop' );
if( get_post_field( 'post_name') != 'subscription' ) {
wc_get_template_part( 'content', 'product' );
}
}
}
woocommerce_product_loop_end();
echo '</div>';
} else {
do_action( 'woocommerce_no_products_found' );
}
get_footer( 'shop' );