Snippets: Add a Show All Button to the WooCommerce Shop

// Insert a show all button below the products (change the hook to fit your needs)
add_action( 'wpex_hook_content_bottom', function() {
	if ( empty( $_GET[ 'show_all' ] ) && ( wpex_is_woo_shop() || wpex_is_woo_tax() ) ) {
		echo '<a href="' . esc_url( wpex_get_current_url() ) . '/?show_all=1" class="theme-button">Show All</a>';
	}
} );

// Check for the show_all parameter and alter the posts_per_page parameter for the shop to -1
add_filter( 'loop_shop_per_page', function( $cols ) {
	if ( ! empty( $_GET[ 'show_all' ] ) ) {
		$cols = -1;
	}
	return $cols;
}, PHP_INT_MAX );
All PHP snippets should be added via a child theme's functions.php file.