|
/* You can also just supply a custom array of list filters you wish to apply */ |
|
$request->setFilters([ |
|
[ |
|
'name' => 'search', |
|
'value' => [ |
|
'field' => 'code', |
|
'operator' => 'EQ', |
|
'value' => 'Foo' |
|
] |
|
], |
|
[ |
|
'name' => 'search_AND', |
|
'value' => [ |
|
'field' => 'price', |
|
'operator' => 'GT', |
|
'value' => 9.99 |
|
] |
|
] |
|
]); |
I needed to filter orders based on a custom field so I used this example. I could not get it to work until I put the value array inside of an array. My assumption may be wrong, but my code below only worked when I added the array.
$request->setFilters([
[
'name' => 'search',
'value' => [
[
'field' => 'CustomField_Values:customfields:' . OrderCustomFields::PENDING_CANCEL_CODE,
'operator' => 'EQ',
'value' => true
]
]
]
]);
api-sdk-php/examples/ListQueryExample.php
Lines 87 to 105 in a113b9c
I needed to filter orders based on a custom field so I used this example. I could not get it to work until I put the value array inside of an array. My assumption may be wrong, but my code below only worked when I added the array.