jogin shar
jogin shar

Reputation: 57

How can i Search product with EAN number in admin order page

Thats how i am showing EAN number in Woocommerce Admin order page . This works well, but I'd like to extend this functionality. I want to enable searching for products in the order page not only by SKU but also by their EAN. Could you please help me modify the code to achieve this? I'm looking for a solution that allows admin users to quickly find and add products to orders by entering their EAN in the order item search field. Thanks in advance for your time and assistance.

 add_filter('woocommerce_json_search_found_products', function($products) {
    foreach ($products as $product_id => $product_name) {
        $product = wc_get_product($product_id);
        if ($product) {
            $ean = $product->get_global_unique_id();
            $product_name .= ' – ' .$ean;
            $products[$product_id] = $product_name;
        }
    }
    return $products;
}); 

here admin order panel

Upvotes: 0

Views: 70

Answers (0)

Related Questions