<p>We are working on providing better search for entries, products, orders,  and all other custom elements in Craft within Craft 3. For example we recently added the search keywords method to the element interface to allow searching on non core attributes or custom fields: <a href="https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a" rel="nofollow noreferrer">https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a</a></p>

<p>The above additions like above will help us provide searching on attributes that aren't actual properties/getter methods on the order.</p>

<p>This of course doesn't help you in the short term when searching for orders on the attributes you listed. I have added it as a priority to see if we can somehow make searching on those attributes easier in Commerce 1.x</p>

<p>A temporary work around would be adding the information to the search index by creating some pre-parse custom fields: <a href="https://github.com/aelvan/Preparse-Field-Craft" rel="nofollow noreferrer">https://github.com/aelvan/Preparse-Field-Craft</a></p>

<p>For example you could create a pre-parse field called "businessShippingName" and add it to the order field layout. In the settings for that field, you could use the template: <code>{{ commerce_order.shippingAddress.businessName }}</code>. This would allow you to search based on the business shipping name, as well as list it more easily in the order index screen.</p>

CC BY-SA 3.0
2017-02-27T12:00:08.993Z
Thanks for the input Luke. I also noticed that you cannot search based on an Order Number or even an Entry ID. I'm not trying to be contrary but I'm just baffled by this. An ecomm solution where one cannot find/filter order by an ID? I hope something can be done about that. It seems like a significant miss for a standard feature of any ecomm system.
Mike
CC BY-SA 3.0
2017-02-27T14:44:15.770Z
Hi Mike, have you turned on fuzzy searching in your Craft config?http://craftcms.stackexchange.com/a/11872/91  Let me know if that helps? Order number and order email etc should be searchable already, but if you do not search for the full string, fuzzy might help.
Luke Holder
CC BY-SA 3.0
2017-02-27T14:54:08.613Z
Ah - thanks Luke. I thought fuzzy searching was only for front end searches. That definitely helps for using the order number field.
Mike
CC BY-SA 3.0
2017-07-26T15:47:26.750Z
I have created a pre-parse filed called orderSearchableName and within this added the following code; {{ commerce_order.billingAddress.firstName }} {{ commerce_order.billingAddress.lastName }} - I can see this is populating if I show this column on the order screen, however running a search 9with fuzzy enabled) is still not finding anything within this field. Is there a step I am missing?
Terry Upton
CC BY-SA 3.0
2017-02-22T12:06:13.387Z
2017-02-22T12:06:13.387Z
Luke Holder
<p>Right now (Feb 2017), there are indeed a distinct lack of order searching options for orders with Commerce.  I don't know if you'd call it 'intended behaviour' so much as an oversight or at least lower priority at the moment....(my suspicion is that because P &amp; T themselves sell only virtual products, it's not quite as obvious to them how necessary this is for non-virtual goods sellers - but it may be I'm being totally unfair there!).  </p>

<p>It's a frustration for our staff that I have mentioned along the way a few times.  There's a related feature request here:
<a href="https://github.com/craftcms/commerce/issues/186" rel="nofollow noreferrer">https://github.com/craftcms/commerce/issues/186</a>  </p>

CC BY-SA 3.0
2017-05-11T16:10:22.967Z
Do you know if it's possible to extend the search and write the functionality on my own? And if it is, any idea how to approach it, or where to look for inspiration? Or is adding custom (sortable) column to the orders table the only enhancement I can make here?

EDIT: Ignore me, I've completely forgot about what's listed in Luke's answer below.
ijust
CC BY-SA 3.0
2017-07-26T15:26:52.277Z
I am still having this batted back at me almost weekly by my clients using Craft Commerce. If there is anything that can be done?
Terry Upton
CC BY-SA 3.0
2017-02-19T23:23:33.310Z
Thanks for the input Jeremy. Indeed, it seems like a bit of an oversight. Certainly with clients who we've built other ecomm solutions for, this would be a definite pain point. I'd also guess this isn't something a plugin could - at least easily - address (probably too wrapped up in core files). +1 to the feature request as this is an issue we'll need to weigh with Commerce.
Mike
CC BY-SA 3.0
2017-02-20T10:13:33.923Z
I get these complaints, too. You'd have thought you'd be able to sort by order number, order short number, order ID at least.
Clive Portman
CC BY-SA 3.0
2017-02-19T23:17:12.597Z
2018-03-28T23:54:47.257Z
2018-03-28T23:54:47.257Z
Jeremy Daalder
<p>I'm trying to figure out how searching for Commerce Orders in the CP works. I've run some tests searching against the following fields:</p>

<ul>
<li>Shipping Business Name</li>
<li>Billing Business Name</li>
<li>Shipping Method</li>
</ul>

<p>In all cases, searches seem to match nothing in these columns. For example, if the Shipping Business Name was "Acme" and I enter that in the CP search bar, I get no results.</p>

<p>Is this expected behaviour? That seems hard to believe if it is. How would a user filter down the list of Orders for a particular company or shipping method... or whatever?</p>

<plugin-craftcommerce><control-panel><search>
Commerce Orders Search Bug in CP?
# Commerce Orders Search Bug in CP?

(Asked by: username_0 on 2017-02-19)

I'm trying to figure out how searching for Commerce Orders in the CP works. I've run some tests searching against the following fields:

* Shipping Business Name
* Billing Business Name
* Shipping Method

In all cases, searches seem to match nothing in these columns. For example, if the Shipping Business Name was "Acme" and I enter that in the CP search bar, I get no results.

Is this expected behaviour? That seems hard to believe if it is. How would a user filter down the list of Orders for a particular company or shipping method... or whatever?

**Tags:** plugin-craftcommerce, control-panel, search

---

## 2 answers

### Answer by username_1 on 2017-02-22. Score: 3

We are working on providing better search for entries, products, orders, and all other custom elements in Craft within Craft 3. For example we recently added the search keywords method to the element interface to allow searching on non core attributes or custom fields: <https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a>

The above additions like above will help us provide searching on attributes that aren't actual properties/getter methods on the order.

This of course doesn't help you in the short term when searching for orders on the attributes you listed. I have added it as a priority to see if we can somehow make searching on those attributes easier in Commerce 1.x

A temporary work around would be adding the information to the search index by creating some pre-parse custom fields: <https://github.com/aelvan/Preparse-Field-Craft>

For example you could create a pre-parse field called "businessShippingName" and add it to the order field layout. In the settings for that field, you could use the template: `{{ commerce_order.shippingAddress.businessName }}`. This would allow you to search based on the business shipping name, as well as list it more easily in the order index screen.

> **Comments:**
> **username_0**: Thanks for the input Luke. I also noticed that you cannot search based on an Order Number or even an Entry ID. I'm not trying to be contrary but I'm just baffled by this. An ecomm solution where one cannot find/filter order by an ID? I hope something can be done about that. It seems like a significant miss for a standard feature of any ecomm system.  
> **username_1**: Hi Mike, have you turned on fuzzy searching in your Craft config?http://craftcms.stackexchange.com/a/11872/91  Let me know if that helps? Order number and order email etc should be searchable already, but if you do not search for the full string, fuzzy might help.  
> **username_0**: Ah - thanks Luke. I thought fuzzy searching was only for front end searches. That definitely helps for using the order number field.  
> **username_2**: I have created a pre-parse filed called orderSearchableName and within this added the following code; {{ commerce_order.billingAddress.firstName }} {{ commerce_order.billingAddress.lastName }} - I can see this is populating if I show this column on the order screen, however running a search 9with fuzzy enabled) is still not finding anything within this field. Is there a step I am missing?  

---

### Answer by username_3 on 2017-02-19. Score: 1

Right now (Feb 2017), there are indeed a distinct lack of order searching options for orders with Commerce. I don't know if you'd call it 'intended behaviour' so much as an oversight or at least lower priority at the moment....(my suspicion is that because P & T themselves sell only virtual products, it's not quite as obvious to them how necessary this is for non-virtual goods sellers - but it may be I'm being totally unfair there!).

It's a frustration for our staff that I have mentioned along the way a few times. There's a related feature request here:
<https://github.com/craftcms/commerce/issues/186>

> **Comments:**
> **username_0**: Thanks for the input Jeremy. Indeed, it seems like a bit of an oversight. Certainly with clients who we've built other ecomm solutions for, this would be a definite pain point. I'd also guess this isn't something a plugin could - at least easily - address (probably too wrapped up in core files). +1 to the feature request as this is an issue we'll need to weigh with Commerce.  
> **username_5**: I get these complaints, too. You'd have thought you'd be able to sort by order number, order short number, order ID at least.  
> **username_4**: Do you know if it's possible to extend the search and write the functionality on my own? And if it is, any idea how to approach it, or where to look for inspiration? Or is adding custom (sortable) column to the orders table the only enhancement I can make here?  EDIT: Ignore me, I've completely forgot about what's listed in Luke's answer below.  
> **username_2**: I am still having this batted back at me almost weekly by my clients using Craft Commerce. If there is anything that can be done?  

---

