Introduction
Many themes don’t include the body field as part of the search condition in the drawer (the search that appears when clicking the search icon in the top-right corner).
In some cases, you may want to include the body field in search results.
Solution
Before making any changes, it’s highly recommended to create a backup copy of your theme by clicking the Duplicate button.
Go to Online Store → Themes, and on your current theme, click Edit code:
Next, search for the term "resources[options][fields]"
in your theme’s files. This is often found inside a file like search.js
.
For example, you might see a line like this:
url.searchParams.set('resources[options][fields]', 'title,product_type,variants.title,variants.barcode');
Modify it to include the body field:
url.searchParams.set('resources[options][fields]', 'title,product_type,variants.title,body,variants.barcode');
Testing
Finally, test the search feature to ensure it works as expected.
If you encounter any issues (such as the drawer not opening or no results appearing), check the browser’s developer console for JavaScript errors or inspect the network requests and responses.