Skip Navigation

[Fermé] Empty duplicate Toolset Woocommerce Field Groups

This support ticket is created Il y a 11 mois et 1 semaine. There's a good chance that you are reading advice that it now obsolete.

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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Waqar Il y a 11 mois.

Assisté par: Waqar.

Auteur
Publications
#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: lien caché

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

Le sujet ‘[Fermé] Empty duplicate Toolset Woocommerce Field Groups’ est fermé à de nouvelles réponses.