wckalkulator icon indicating copy to clipboard operation
wckalkulator copied to clipboard

Fix product fieldset persistence issue by removing WooCommerce query limit

Open luka1199 opened this issue 11 months ago • 1 comments

This PR fixes an issue where saving more than 10 products in a fieldset caused some products to disappear after saving and reloading the fieldset. The issue was due to WooCommerce’s default product query limit of 10, which prevented all selected products from being retrieved when reloading the fieldset.

Bug Effects If more than 10 product IDs were stored in the fieldset, only the first 10 (based on WooCommerce’s internal query order) were loaded. Any products beyond this limit were not displayed in the fieldset after reloading. If the user saved again without noticing the missing products, they would be permanently removed from the fieldset.

Fix Updated the wc_get_products() query to explicitly set 'limit' => -1, ensuring all selected products are always retrieved. This prevents products from being unintentionally excluded and removed upon subsequent saves.

luka1199 avatar Feb 02 '25 13:02 luka1199

@piatkowski could you look over the changes?

luka1199 avatar Feb 25 '25 16:02 luka1199