Ecommerce Shopify WordPress Discussion

Trying To Get A PHP Filter To Work In WordPress To Show Unlimited Products On The Page During Custom Search

Have a custom live search feature on our wordpress website, which only displays 20 products in the middle of the screen for any given search. Would like to be able to remove this 20 limit, so that either 50 products, or unlimited products are shown.(Would like to try both options, to see which works best). So far have come up with the code below for our function.php file, which unfortunately doesn't work: The below php filter is based on unlimited products showing after the live search. function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_wpsc_gc_live_search_pre_get_posts) { $query->set('posts_per_page', -1); } } } add_action('pre_get_posts','search_filter');` Code below from the live search file that may help with the tweaking of the above code: function wpsc_gc_start_search_query() { global $wp_query, $wpsc_query; $product_page_id = wpsc_get_the_post_id_by_shortcode('[productspage]'); $post = get_post( $product_page_id ); $wp_query = new WP_Query( array( 'pagename' => $post->post_name ) ); add_action( 'pre_get_posts', 'wpsc_gc_live_search_pre_get_posts' ); wpsc_start_the_query(); remove_action( 'pre_get_posts', 'wpsc_gc_live_search_pre_get_posts' ); list( $wp_query, $wpsc_query ) = array( $wpsc_query, $wp_query ); // swap the wpsc_query object $GLOBALS['nzshpcrt_activateshpcrt'] = true; What we are basically trying to do is set the following: Number of products per page to show during the live search, at either 50, or unlimited (would like to try both scenarios). Code below, which relates to the number of products showing per page: wpsc_products_per_page Would be great for some help and advise on how we can getting the above filter to work. Created the above filter for our themes function.php file, which needs tweaking. Have also tried changing 'posts_per_page' to 'wpsc_products_per_page' which didn't work.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.