$GLOBALS['woocommerce_loop']['total'] = false; } public static function add_product_table_after_shop_loop() { $shortcode = '[product_table]'; $args = shortcode_parse_atts( str_replace( [ '[product_table', ']' ], '', $shortcode ) ); $args = ! empty( $args ) && is_array( $args ) ? $args : []; $shop_templates_tables = Util::get_shop_templates_tables(); if ( is_shop() ) { if ( isset( $shop_templates_tables['shop_override'] ) ) { $args['id'] = $shop_templates_tables['shop_override']['id']; } } elseif ( is_product_category() ) { // Product category archive $args['category'] = get_queried_object_id(); if ( isset( $shop_templates_tables['archive_override'] ) ) { $args['id'] = $shop_templates_tables['archive_override']['id']; } } elseif ( is_product_tag() ) { // Product tag archive $args['tag'] = get_queried_object_id(); if ( isset( $shop_templates_tables['product_tag_override'] ) ) { $args['id'] = $shop_templates_tables['product_tag_override']['id']; } } elseif ( is_product_taxonomy() ) { // Other product taxonomy archive $term = get_queried_object(); $args['term'] = "{$term->taxonomy}:{$term->term_id}"; if ( isset( $shop_templates_tables[ $term->taxonomy . '_override' ] ) ) { $args['id'] = $shop_templates_tables[ $term->taxonomy . '_override' ]['id']; } } elseif ( is_post_type_archive( 'product' ) && ( $search_term = get_query_var( 's' ) ) ) { // Product search results page $args['search_term'] = $search_term; if ( isset( $shop_templates_tables['search_override'] ) ) { $args['id'] = $shop_templates_tables['search_override']['id']; } } // Display the product table wc_the_product_table( $args ); } }