Home › Toolset Professional Support › [Resolved] Toolset Woocommerce starts multiplying custom fields in back-end
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Toolset Blocks
This topic contains 8 replies, has 2 voices.
Last updated by dirkV-2 3 years, 5 months ago.
Assisted by: Nigel.
I am trying to:
Since a week Toolset Woocommerce is duplicating or multiplying the custom fields. Already more then hundred times now, which slows also down the loading time of the "edit product" page...
Link to a page where the issue can be seen: It's in the back-end
I expected to see:
Instead, I got:
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Do you have more details about how to reproduce the issue?
Or could we access your site to see the problem for ourselves?
Let me mark your next reply as private in case you are happy to share log-in credentials with us—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
The problem specifically occurs when editing products in the back end?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Oh! Now I see what you mean.
That's not good.
In Toolset WooCommerce Blocks 3.0 we made changes to how custom fields relating to products are managed, and this is clearly a side effect of something that has gone wrong with that on your site.
I'm taking a copy of your site to share with the developers, and I'll update you again when I have some feedback.
Thank you, Nigel.
Looking forward to your update!
thanks,
Dirk
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Dirk
This is with the developers, but the issue for sure relates to the custom plugin you have installed, 'ced custom code', and the way it intercepts some WooCommerce-related queries and tricks Toolset WooCommerce Blocks into thinking that a Custom Field Group for products is missing, causing it to recreate it.
We're still looking into the details, it's likely you'll need to make some changes to that custom plugin.
In the meantime, the key problem with your site is the large number (over 800) duplicate custom field groups for WooCommerce that have been automatically generated.
As a temporary workaround, you could add the following code at Toolset > Settings > Code Snippets. Don't activate it, but instead use the Run Now option to run the code once, and then keep doing that as many times as are needed to remove the duplicates.
$wcfgs = get_posts( array( 'post_type' => 'wp-types-group', 'title' => 'Toolset WooCommerce', 'numberposts' => 25 )); foreach ($wcfgs as $key => $wcfg) { wp_delete_post( $wcfg->ID, true ); }
On my local copy of your site I found it could only cope with deleting about 25 at a time, so it will take a while to purge the excess copies.
(You don't have to worry about deleting too many; if you delete the last one it will be automatically recreated. In fact, until we have news of a fix whatever action it is that causes them to be generated, you'll likely have to repeat this every now and again.
I'll update again when I have more news.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
The developers looked into the problem and say it occurs because of the poorly coded custom plugin ced custom code.
Let me quote from their reply:
When visiting the products and the shop orders admin listing pages, under wp-admin/edit.php?post_type=product and wp-admin/edit.php?post_type=shop_order you can see a number of selectors to filter by and narrow down what is shown in those listing tables. However, the logic used to apply those filters targets ALL queries executed in those pages, not just the one generating the products or shop orders to be shown.
The end result is that our query to check whether our custom field group has been registered already gets polluted with extra query arguments enforcing filters by custom fields and/or taxonomies. Which if course makes the query fail to find the existing field group, hence a new one is generated.
This means that a new field group has been generated every time someone accessed those product and shop order admin pages and performed a filtering.
I would advise the site owner to properly manage such admin listing pages filtering, because the logic used there will cause harm not only to us, but also to cron jobs and third parties in general.
So you will need to update the custom code plugin to correctly only target the main queries on those backend pages for products and orders.
If you are unable to do that, you would need to downgrade the Toolset WooCommerce Blocks plugin to the last version prior to the 3.0 release (and would never be able to upgrade). Prior versions are available from the changelog for the plugin on your downloads page at toolset.com/account/downloads.
You will, in any case, need to purge the surplus field groups as described in my previous reply.
Thank you, Nigel.
I transferred the answer from your developers to the developers of the custom plugin. They made some changes.
In the meantime, I tried to make the clean-up with the code snippet you provided, but I get some errors. Could you see what happened? Thanks in advance. This is the error:
Last error
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
E_NOTICE: Undefined index: product-suplier in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 415
E_NOTICE: Undefined index: product-type in file /home/customer/www/peckhamsoul.co.uk/public_html/wp-content/plugins/ced-custom-code/ced-custom-code.php on line 422
Note: Depending on the nature of the error, you may need to run the script in a particular scenario to make sure the issue is gone.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Those notices are not coming from the code I shared with you, they are coming from lines 415 and 422 of the ced-custom-code plugin.
Your developer should be able to identify the cause.
My issue is resolved now. Thank you!