|
20 | 20 | | [customerId](#customerid) | Narrows the query results based on the customer, per their user ID. |
21 | 21 | | [dateAuthorized](#dateauthorized) | Narrows the query results based on the orders’ authorized dates. |
22 | 22 | | [dateCreated](#datecreated) | Narrows the query results based on the orders’ creation dates. |
| 23 | +| [dateFirstPaid](#datefirstpaid) | Narrows the query results based on the orders’ first paid dates. |
23 | 24 | | [dateOrdered](#dateordered) | Narrows the query results based on the orders’ completion dates. |
24 | 25 | | [datePaid](#datepaid) | Narrows the query results based on the orders’ paid dates. |
25 | 26 | | [dateUpdated](#dateupdated) | Narrows the query results based on the orders’ last-updated dates. |
@@ -422,6 +423,42 @@ $orders = \craft\commerce\elements\Order::find() |
422 | 423 | ::: |
423 | 424 |
|
424 | 425 |
|
| 426 | +#### `dateFirstPaid` |
| 427 | + |
| 428 | + |
| 429 | +Narrows the query results based on the orders’ first paid dates. |
| 430 | + |
| 431 | +Possible values include: |
| 432 | + |
| 433 | +| Value | Fetches orders… |
| 434 | +| - | - |
| 435 | +| `'>= 2018-04-01'` | that were first paid on or after 2018-04-01. |
| 436 | +| `'< 2018-05-01'` | that were first paid before 2018-05-01 |
| 437 | +| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were first paid between 2018-04-01 and 2018-05-01. |
| 438 | + |
| 439 | + |
| 440 | + |
| 441 | +::: code |
| 442 | +```twig |
| 443 | +{# Fetch orders that were first paid for recently #} |
| 444 | +{% set aWeekAgo = date('7 days ago')|atom %} |
| 445 | +
|
| 446 | +{% set orders = craft.orders() |
| 447 | + .dateFirstPaid(">= #{aWeekAgo}") |
| 448 | + .all() %} |
| 449 | +``` |
| 450 | + |
| 451 | +```php |
| 452 | +// Fetch orders that were first paid for recently |
| 453 | +$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM); |
| 454 | + |
| 455 | +$orders = \craft\commerce\elements\Order::find() |
| 456 | + ->dateFirstPaid(">= {$aWeekAgo}") |
| 457 | + ->all(); |
| 458 | +``` |
| 459 | +::: |
| 460 | + |
| 461 | + |
425 | 462 | #### `dateOrdered` |
426 | 463 |
|
427 | 464 |
|
@@ -469,7 +506,7 @@ Possible values include: |
469 | 506 | | - | - |
470 | 507 | | `'>= 2018-04-01'` | that were paid on or after 2018-04-01. |
471 | 508 | | `'< 2018-05-01'` | that were paid before 2018-05-01 |
472 | | -| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01. |
| 509 | +| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were paid between 2018-04-01 and 2018-05-01. |
473 | 510 |
|
474 | 511 |
|
475 | 512 |
|
|
0 commit comments