Search Component getUrl Method for SuiteCommerce Usage
Use the Search component's getUrl method to build dynamic item search URLs in SuiteCommerce, including session parameters.
The Search component includes the getUrl() method, allowing developers to retrieve the URL of the item search API for SuiteCommerce websites. When getUrl() is invoked, it returns a string representing the end fragment of the item search URL (everything after the domain name). You can enhance your search URL by appending parameters through an object where the properties correspond to the desired search criteria.
Here's how to implement getUrl() to find items containing the string 'shirt'. This method is typically called within the mountToApp() method of your extension's entrypoint module.
"text-purple-400">var search = container.getComponent('Search');"text-purple-400">var searchParams = {q: "shirt"}; "text-purple-400">var searchURL = search.getUrl(searchParams);With the search parameters noted above, the generated URL might look like this:
api/items?language=en&country=US¤cy=USD&pricelevel=5&use_pcv=F&q=shirt
Take note that the returned URL incorporates data based on the site visitor's session and includes the appended search parameters (q=shirt). The default parameters drawn from the user's session are:
- language
- country
- currency
- pricelevel
- use_pcv
Frequently Asked Questions (4)
How can I include additional search criteria with the getUrl method in SuiteCommerce?
What session data is automatically included in the URL generated by getUrl?
Where should the getUrl method be called within a SuiteCommerce extension?
Is the getUrl method available for all SuiteCommerce implementations?
Was this article helpful?
More in Commerce
- Available Items Only Feature in NetSuite 2026.1
Available items only filtering boosts sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
- Commerce Extensions in NetSuite 2026.1
Commerce Extensions in NetSuite 2026.1 enhance performance and user experience in eCommerce.
- Convert Multiple Transaction Line Items into Configured Items in
Enhance transaction processing in NetSuite by converting multiple line items into configured items with improved session handling.
- New SuiteCommerce Features in NetSuite 2026.1
New SuiteCommerce features in NetSuite 2026.1 enhance user experience and improve eCommerce efficiency.
