Is there a way to return result for 'SKU', if the customer search for the term like 'AA-SKU2033'?

Currently, our product has the following format on the actual product sticker 'AA-SKU2033'

'AA-' is the prefix, and it's always the same.
'SKU' is the actual SKU on magento 2 website
'2033' is a four digit numbers for lot number purpose, for example year of 2020 and week of 33, and it changes overtime. 

Is there a way for magento to handle that? or is there a recommended search extension can be configured to work with it?

I'm currently on magento 2.2.9 Thanks.

  • first you should ensure that the sku attribute is enabled for search. depending on your search engine mysql/elasticsearch the hyphen (-) can be treated as a space which increases false positives in search. you can improve the results using search synonyms configurable in admin,
    – paj
    Commented Apr 22, 2020 at 17:46
  • hi paj, thank you for the advise. yes the sku attribute is enabled. my concern is, for example, my sku number is BAG, but if the customer search for AA-BAG1234, i would like it to return result of 'BAG'. in here, 'AA-' is the prefix, and '1234' is suffix and can be any number. Right now, if search for AA-BAG, it does return the result of 'BAG', i think the tricky part is how to handle those 4 digits in the suffix? thanks Commented Apr 22, 2020 at 18:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.