SupportCategory: Free Product Sample for WooCommercePro plugin crashes if there are too many products
Robert Gillmer asked 1 month ago

We’ve got your plugin installed on a site with 1200 products.  When we try to go to /wp-admin/admin.php?page=woo-free-product-sample, the screen won’t load because it uses too much memory.
I am able to resolve the issue by commenting out lines 107 to 116 of woocommerce-free-product-sample-pro/includes/class-woo-free-product-sample-pro-settings.php, to remove the following:

/* array(
‘name’ => ‘enable_product’,
‘label’ => __( ‘Enable Proudcts’, ‘woo-free-product-sample-pro’ ),
‘class’ => ‘widefat wfps-hight-400’,
‘type’ => ‘multi-select’,
‘description’ => __( ‘Products’, ‘woo-free-product-sample-pro’ ),
‘default’ => self::woo_free_product_sample_products(),
‘style’ => ‘class=”wfps-enable-product-area”‘,
‘position’ => ‘tr’
), */

The problem is the self::woo_free_product_sample_products() function.  Even if I unset enable_product with a filter, the function has already run and has crashed the site.

I’d like to request a filter in woocommerce-free-product-sample-pro/includes/class-woo-free-product-sample-pro-settings.php for the function

woo_free_product_sample_products(), to allow me to change the args for the get_posts() call.  If I could change numberposts to something other than -1, I can then use a filter to unset enable_product completely.

1 Answers
hossain88 Staff answered 1 month ago

Allow me to check it