How to make WP native search work on Woocommerce SKU numbers?

I’m at a loss.

I think it’s too silly to use a bloaty plugin to just achieve this little feat, but I’m at a loss now.

This is what I tried. Manually adding and hiding the number (with display:none) within product description works. It also works if within the short description. This will cause the search query to pick up on the numbers, but it’s obviously impractical to do.

So, I tried using the hook woocommerce\_short\_description and echo it there. Does not work.

There’s no hook for main product description (the\_content of WC), so I try to append it to the content here. It shows up perfectly, but you still can’t search for it.

I don’t understand what the difference is between writing the SKU to the product content field and echoing it.

In screenshot. Read arrow is inserted via WC product field, while blue arrow is echoed via PHP. Only the first appears to make it possible to query the product via search: [https://markuphero.com/share/0VqeRYKiZdPMFpL1d7YX](https://markuphero.com/share/0VqeRYKiZdPMFpL1d7YX)

Do you know how to make this work?

Thanks for reading my rant..

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer