OpenCart search by SKU — why half a code finds nothing
Product names are matched with a wildcard. Product codes are not: OpenCart compares them for exact equality against the whole search box. Type seven characters of an eight-character SKU and you get zero results — not a worse result, zero.
The cause
Names use LIKE. Codes use =.
All of OpenCart’s product search lives in one method — `getProducts()` in `catalog/model/catalog/product.php` — and it treats the two kinds of text completely differently. Names are split into words and each word is matched with a leading-and-trailing wildcard. Codes are compared whole, with `=`.
That is why searching “macbook” finds the MacBook and searching “PROD-100” finds nothing unless the SKU is exactly `PROD-100`, in full, with nothing else in the box.
-- OpenCart 3.0.5.0, catalog/model/catalog/product.php
pd.name LIKE '%macbook%' -- wildcard, per word
OR LCASE(p.model) = 'prod-100' -- exact
OR LCASE(p.sku) = 'prod-100' -- exact
OR LCASE(p.upc) = 'prod-100' -- exact
OR LCASE(p.ean) = 'prod-100' -- exact
-- …jan, isbn, mpn, all the same
Both majors
OpenCart 4 narrowed it further
OpenCart 3 compares seven identifier columns — model, SKU, UPC, EAN, JAN, ISBN and MPN — each with `=`. OpenCart 4 moved the extra identifiers into a `product_code` table and searches only two things: `model`, still with `=`, and the code table with a prefix match.
So on 4.x a code entered in the identifier table matches from the start (`PROD%`), and the model field still does not. On 3.x nothing matches partially at all. Neither behaves the way a shopper who half-remembers a code expects.
Why it matters
The people typing codes are the ones ready to buy
A shopper typing a product code is not browsing. They have a part number from a manual, an invoice or a competitor’s page, and they are trying to buy that exact thing. A zero-results page is the most expensive one your shop can serve them.
It is also invisible in your own testing, because you always type the whole code correctly.
More about OpenCart search
Why does OpenCart find nothing when I search part of a SKU?
Because it compares codes with `=` rather than a wildcard. `LCASE(p.sku) = ‘<whatever is in the box>’` is either an exact match or no match — there is no partial credit, and no amount of re-indexing changes it.
Does ticking “Search in product descriptions” help?
Only if the code also appears in the description text, because that checkbox adds one more `LIKE ‘%term%’` on the description column. It is a workaround that depends on you having typed the code into the description of every product.
Is this different on OpenCart 4?
Yes, and it is still not what a shopper expects. OpenCart 4 searches the `model` field with `=` and the product-code table with a prefix match, so a code matches from its first character but not from the middle. OpenCart 3 matches seven identifier columns, all with `=`.
How does NitroSearch handle codes?
SKUs and model numbers are indexed as searchable text alongside the product name, and matched as the shopper types from the first characters. They also survive a typo, which an equality comparison by definition cannot.
OpenCart behaviour on this page last checked against live OpenCart 4.1.0.3 and 3.0.5.0 installs on 2026-08-05.
Give your shoppers search that finds things
Free up to 100 search results, no card, no time limit. Paid plans start at $5.99/mo and are priced by catalogue size — never per search.