• Resolved hotwebideas

    (@hotwebideas)


    Hello, I manage a WooCommerce website where multiple authors can link a simple product to a grouped product inside the Linked Products tab of the grouped product. Is there a hook to automatically detect this action?

    Thank you for your help.
    Bruce

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    At the moment the product is added I don’t think so, because that will most likely be done via javascript/jQuery/ajax. At the moment that the changes will be saved, you could use ‘woocommerce_update_product hook’ to detect changes.

    Hey, I have further investigated this.

    The code seems to come from this file and in particular the following code line with data-action =”woocommerce_json_search_products_and_variations”

    If you search further on this.. you find the next file

    function filter_woocommerce_json_search_found_products( $array ) { 
        // make filter magic happen here... 
        return $array; 
    }; 

    With this as the final result

    // add the filter 
    add_filter( 'woocommerce_json_search_found_products', 'filter_woocommerce_json_search_found_products', 10, 1 ); 

    So in this way you add ‘extra text’ to the search results of the product array, so you can also detect changes there

    function filter_woocommerce_json_search_found_products( $products ) {
        $products[] = 'extra text';
    
        return $products; 
    }
    add_filter( 'woocommerce_json_search_found_products', 'filter_woocommerce_json_search_found_products', 10, 1 ); 

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any further questions!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Looking for a hook to detect if a product is linked to a grouped product’ is closed to new replies.