How to show SKU, and other custom fields in the search widget

I am using woocommerce and having a search bar. When i type something, some product suggestions are there with product titles and contents.

How can i have “SKU: 1234” and "{custom field}:1234} right below each content?

Hi @crawdz

I’m not familiar with the woocommerce WP plugin, but if it’s using the Algolia API for search, the API should be returning a JSON Hits array with the matching records. You should be able to modify your display PHP to include any additional attributes that were in the index records.

Sorry to be so vague, but a lot of this comes down to how WP, woocommerce, and Algolia have been integrated.

@crawdz Are you using the WP Search with Algolia plugin with your setup?

If yes, do you have your SKUs being included as part of your product indexes? If yes on that part, then depending on how you set that part up, it’d be part of the data object that WP Search with Algolia templates use.

no i dont use WPSearch. I only use default theme search bar

Noted on that part, the reason I asked was because of how to potentially customize the template being used, for which I know how, if/when using WP Search with Algolia – WordPress plugin | WordPress.org