Hi Thia,
Unfortunately this does not work. I’m using a child theme.
To understand where the problem is I have tried and successfully implement this plugin using the standard WooCommerce template override process using the Storefront Child Theme. This demonstrates the plug and process in the guide work for both the Shop Landing Page and Product Archive Pages with the normarl template override process.
There are 2 different problems with the code you helpfully provided.
Problem 1.
Using just the Shop Landing Page code, products are not displayed to screen though I can see the rendered code and the load more button. I have also added the products col-3 class ( I’ve also tried removing them with no success either). For ease of reading I’ve only pasted the relevant php block
if ( is_shop() ) { // Shop Landing Page
echo do_shortcode('[ajax_load_more post_type="product" css_classes="products col-3" posts_per_page="12" pause="true" button_label="View More" button_loading_label="Loading More" transition="fade"]');
} else { //Single Product Page
woocommerce_content();
}
Problem 2.
When using the code including the Product Archive Page as follows - again, only pasting the relevant php block.
if ( is_archive() ) { // Product Archives
$obj = get_queried_object();
$taxonomy = $obj->taxonomy; // Get taxonomy
$taxonomy_term = $obj->slug; // Get term
echo do_shortcode('[ajax_load_more post_type="product" taxonomy="'. $taxonomy .'" taxonomy_terms="'. $taxonomy_term .'" taxonomy_operator="IN" css_classes="products col-3" posts_per_page="12" pause="true" button_label="View More" button_loading_label="Loading More" transition="fade"]');
} else if ( is_shop() ) { // Shop Landing Page
echo do_shortcode('[ajax_load_more post_type="product" css_classes="products col-3" posts_per_page="12" pause="true" button_label="View More" button_loading_label="Loading More" transition="fade"]');
} else { //Single Product Page
woocommerce_content();
}
This code generates the following error:
Notice: Undefined property: WP_Post_Type::$taxonomy in /webapp-development/dev-local.host/wp-content/themes/pro-child/framework/views/ethos/woocommerce.php on line 19
Notice: Undefined property: WP_Post_Type::$slug in /webapp-development/dev-local.host/wp-content/themes/pro-child/framework/views/ethos/woocommerce.php on line 20
Both are caused the following parts of the code
$taxonomy = $obj->taxonomy; // Get taxonomy
$taxonomy_term = $obj->slug; // Get term
As noted, all of this works perfectly and without error following the standard WooCommerce template override process. It seems to be the X / Pro themes preventing this from working - please let me know how to get it work.