Skip Navigation

[Closed] Empty duplicate Toolset Woocommerce Field Groups

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.

Our next available supporter will start replying to tickets in about 6.93 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2676924
Screen Shot 2024-01-02 at 4.52.56 PM.png
Screen Shot 2023-12-08 at 3.00.08 AM.png
Screen Shot 2023-12-08 at 2.02.54 AM.png
Screen Shot 2023-12-08 at 1.56.00 AM.png

I noticed while I was adding some custom code to my site that every time that code block ran, it made a duplicated but empty Toolset Woocommerce Field Group, resulting in the same issue from this older post: https://toolset.com/forums/topic/multiple-empty-field-groups-appeared-out-of-the-blue/

I was able to go in and delete the duplicates in phpmyadmin but wanted to see if anyone knows why this bit of code would have caused it?

I am trying to: Trigger a change to a custom field for the product CPT when the stock value changes to out of stock

Using this hook: hidden link

I created a checkbox field for products to be marked as "discontinued" and this checkbox is a field within my "additional product details" field group that shows on all woocommerce products.

What I wanted to create was a function that would run every time a product changed to out of stock. Each time an out of stock notification triggered, if the wpcf-discontinued-product was checked, then change the product visibility to exclude from catalog.

//Once a discontinued product goes out of stock, change visibility to hidden
//
function hide_if_discontinued_no_stock( $wc_get_product ) {
    
    $is_discontinued = get_post_meta( $post_ID, 'wpcf-discontinued-product', false );
        
    if ( $is_discontinued = 1 ){
        $terms = array( 'exclude-from-catalog' ); // still show when searched for
        wp_set_post_terms( $prod_ID, $terms, 'product_visibility', false );
    }
}

add_action( 'woocommerce_no_stock', 'hide_if_discontinued_no_stock', 10, 1 );

I added the above code and then went to test it by editing products in the wp admin and noticed all these Toolset Woocommerce Field Groups showing up. I deleted the code, tested again, it went away. I re-added the code, more Toolset Woocommerce Field Groups. I have no idea why that code would have triggered it.

#2676999

Hi,

Thank you for contacting us and I'd be happy to assist.

Based on your report, I've run some tests on my website with WooCommerce and the same custom code, but couldn't reproduce this behavior.

Would it be possible for you to create a staging website, where the issue can be seen with a minimal setup and steps? You can then share that website's admin access details with us, for further troubleshooting.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details for a production website.

regards,
Waqar

The topic ‘[Closed] Empty duplicate Toolset Woocommerce Field Groups’ is closed to new replies.