`.
+
+
+
+Options
+
+
+--force, -f
+: Force the update if allowUpdates is disabled
+
+
+--backup
+: Backup the database before updating
+
+
+--migrate
+: Run new database migrations after completing the update
+
+
+
+## `users`
+
+Manages user accounts.
+
+
+
+ users/activation-url
+
+
+
+Generates an activation URL for a pending user.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+
+
+ users/create
+
+
+
+Creates a user.
+
+Options
+
+
+--email
+: The user’s email address.
+
+
+--username
+: The user’s username.
+
+
+--password
+: The user’s new password.
+
+
+--admin
+: Whether the user should be an admin.
+
+
+--groups
+: The group handles to assign the created user to.
+
+
+--group-ids
+: The group IDs to assign the user to the created user to.
+
+
+
+
+
+ users/delete
+
+
+
+Deletes a user.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+Options
+
+
+--inheritor
+: The email or username of the user to inherit content when deleting a user.
+
+
+--delete-content
+: Whether to delete the user’s content if no inheritor is specified.
+
+
+--hard
+: Whether the user should be hard-deleted immediately, instead of soft-deleted.
+
+
+
+
+
+ users/impersonate
+
+
+
+Generates a URL to impersonate a user.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+
+
+ users/list-admins
+
+
+
+Lists admin users.
+
+
+
+ users/logout-all
+
+
+
+Logs all users out of the system.
+
+
+
+ users/password-reset-url
+
+
+
+Generates a password reset URL for a user.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+
+
+ users/set-password
+
+
+
+Changes a user’s password.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+Options
+
+
+--password
+: The user’s new password.
+
+
+
+
+
+ users/unlock
+
+
+
+Unlocks a user's account.
+
+Parameters
+
+user
+: The ID, username, or email address of the user account.
+
+
+
+## `utils/ascii-filenames`
+
+
+
+
+ utils/ascii-filenames
+
+
+
+Converts all non-ASCII asset filenames to ASCII.
+
+## `utils/fix-element-uids`
+
+
+
+
+ utils/fix-element-uids
+
+
+
+Ensures all elements UIDs are unique.
+
+## `utils/fix-field-layout-uids`
+
+
+
+
+ utils/fix-field-layout-uids
+
+
+
+Fixes any duplicate UUIDs found within field layout components in the project config.
+
+## `utils/prune-provisional-drafts`
+
+
+
+
+ utils/prune-provisional-drafts
+
+
+
+Prunes provisional drafts for elements that have more than one per user.
+
+Options
+
+
+--dry-run
+: Whether this is a dry run.
+
+
+
+## `utils/prune-revisions`
+
+
+
+
+ utils/prune-revisions
+
+
+
+Prunes excess element revisions.
+
+Options
+
+
+--section
+: The section handle(s) to prune revisions from. Can be set to multiple comma-separated sections.
+
+
+--max-revisions
+: The maximum number of revisions an element can have.
+
+
+--dry-run
+: Whether this is a dry run.
+
+
+
+## `utils/repair`
+
+Repairs data.
+
+
+
+ utils/repair/category-group-structure
+
+
+
+Repairs structure data for a category group.
+
+Parameters
+
+handle
+: The category group handle.
+
+
+
+Options
+
+
+--dry-run
+: Whether to only do a dry run of the repair process.
+
+
+
+
+
+ utils/repair/project-config
+
+
+
+Repairs double-packed associative arrays in the project config.
+
+Options
+
+
+--dry-run
+: Whether to only do a dry run of the repair process.
+
+
+
+
+
+ utils/repair/section-structure
+
+
+
+Repairs structure data for a section.
+
+Parameters
+
+handle
+: The section handle.
+
+
+
+Options
+
+
+--dry-run
+: Whether to only do a dry run of the repair process.
+
+
+
+## `utils/update-usernames`
+
+
+
+
+ utils/update-usernames
+
+
+
+Updates all users’ usernames to ensure they match their email address.
+
+
+
+
diff --git a/docs/.artifacts/cms/4.x/entries.md b/docs/.artifacts/cms/4.x/entries.md
new file mode 100644
index 000000000..b7ad0035a
--- /dev/null
+++ b/docs/.artifacts/cms/4.x/entries.md
@@ -0,0 +1,1980 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [after](#after) | Narrows the query results to only entries that were posted on or after a certain date.
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [ancestorDist](#ancestordist) | Narrows the query results to only entries that are up to a certain distance away from the entry specified by [ancestorOf](#ancestorof).
+| [ancestorOf](#ancestorof) | Narrows the query results to only entries that are ancestors of another entry in its structure.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only entries that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching entries as arrays of data, rather than [Entry](craft4:craft\elements\Entry) objects.
+| [authorGroup](#authorgroup) | Narrows the query results based on the user group the entries’ authors belong to.
+| [authorGroupId](#authorgroupid) | Narrows the query results based on the user group the entries’ authors belong to, per the groups’ IDs.
+| [authorId](#authorid) | Narrows the query results based on the entries’ authors.
+| [before](#before) | Narrows the query results to only entries that were posted before a certain date.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [collect](#collect) |
+| [dateCreated](#datecreated) | Narrows the query results based on the entries’ creation dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the entries’ last-updated dates.
+| [descendantDist](#descendantdist) | Narrows the query results to only entries that are up to a certain distance away from the entry specified by [descendantOf](#descendantof).
+| [descendantOf](#descendantof) | Narrows the query results to only entries that are descendants of another entry in its structure.
+| [draftCreator](#draftcreator) | Narrows the query results to only drafts created by a given user.
+| [draftId](#draftid) | Narrows the query results based on the entries’ draft’s ID (from the `drafts` table).
+| [draftOf](#draftof) | Narrows the query results to only drafts of a given entry.
+| [drafts](#drafts) | Narrows the query results to only drafts entries.
+| [expiryDate](#expirydate) | Narrows the query results based on the entries’ expiry dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [hasDescendants](#hasdescendants) | Narrows the query results based on whether the entries have any descendants in their structure.
+| [id](#id) | Narrows the query results based on the entries’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching entries as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [leaves](#leaves) | Narrows the query results based on whether the entries are “leaves” (entries with no descendants).
+| [level](#level) | Narrows the query results based on the entries’ level within the structure.
+| [limit](#limit) | Determines the number of entries that should be returned.
+| [nextSiblingOf](#nextsiblingof) | Narrows the query results to only the entry that comes immediately after another entry in its structure.
+| [offset](#offset) | Determines how many entries should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the entries should be returned in. (If empty, defaults to `postDate DESC`, or the order defined by the section if the [section](#section) or [sectionId](#sectionid) params are set to a single Structure section.)
+| [positionedAfter](#positionedafter) | Narrows the query results to only entries that are positioned after another entry in its structure.
+| [positionedBefore](#positionedbefore) | Narrows the query results to only entries that are positioned before another entry in its structure.
+| [postDate](#postdate) | Narrows the query results based on the entries’ post dates.
+| [preferSites](#prefersites) | If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [prevSiblingOf](#prevsiblingof) | Narrows the query results to only the entry that comes immediately before another entry in its structure.
+| [provisionalDrafts](#provisionaldrafts) | Narrows the query results to only provisional drafts.
+| [relatedTo](#relatedto) | Narrows the query results to only entries that are related to certain other elements.
+| [revisionCreator](#revisioncreator) | Narrows the query results to only revisions created by a given user.
+| [revisionId](#revisionid) | Narrows the query results based on the entries’ revision’s ID (from the `revisions` table).
+| [revisionOf](#revisionof) | Narrows the query results to only revisions of a given entry.
+| [revisions](#revisions) | Narrows the query results to only revision entries.
+| [savable](#savable) | Sets the [savable](https://docs.craftcms.com/api/v3/craft-elements-db-entryquery.html#savable) property.
+| [savedDraftsOnly](#saveddraftsonly) | Narrows the query results to only unpublished drafts which have been saved after initial creation.
+| [search](#search) | Narrows the query results to only entries that match a search query.
+| [section](#section) | Narrows the query results based on the sections the entries belong to.
+| [sectionId](#sectionid) | Narrows the query results based on the sections the entries belong to, per the sections’ IDs.
+| [siblingOf](#siblingof) | Narrows the query results to only entries that are siblings of another entry in its structure.
+| [site](#site) | Determines which site(s) the entries should be queried in.
+| [siteId](#siteid) | Determines which site(s) the entries should be queried in, per the site’s ID.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the entries’ IDs in the `elements_sites` table.
+| [slug](#slug) | Narrows the query results based on the entries’ slugs.
+| [status](#status) | Narrows the query results based on the entries’ statuses.
+| [title](#title) | Narrows the query results based on the entries’ titles.
+| [trashed](#trashed) | Narrows the query results to only entries that have been soft-deleted.
+| [type](#type) | Narrows the query results based on the entries’ entry types.
+| [typeId](#typeid) | Narrows the query results based on the entries’ entry types, per the types’ IDs.
+| [uid](#uid) | Narrows the query results based on the entries’ UIDs.
+| [unique](#unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [uri](#uri) | Narrows the query results based on the entries’ URIs.
+| [with](#with) | Causes the query to return matching entries eager-loaded with related elements.
+
+
+
+
+
+#### `after`
+
+Narrows the query results to only entries that were posted on or after a certain date.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'2018-04-01'` | that were posted after 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted after the date represented by the object.
+| `now`/`today`/`tomorrow`/`yesterday` | that were posted after midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries posted this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set entries = craft.entries()
+ .after(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch entries posted this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$entries = \craft\elements\Entry::find()
+ ->after($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `ancestorDist`
+
+Narrows the query results to only entries that are up to a certain distance away from the entry specified by [ancestorOf](#ancestorof).
+
+
+
+
+
+::: code
+```twig
+{# Fetch entries above this one #}
+{% set entries = craft.entries()
+ .ancestorOf(myEntry)
+ .ancestorDist(3)
+ .all() %}
+```
+
+```php
+// Fetch entries above this one
+$entries = \craft\elements\Entry::find()
+ ->ancestorOf($myEntry)
+ ->ancestorDist(3)
+ ->all();
+```
+:::
+
+
+#### `ancestorOf`
+
+Narrows the query results to only entries that are ancestors of another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | above the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | above the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries above this one #}
+{% set entries = craft.entries()
+ .ancestorOf(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch entries above this one
+$entries = \craft\elements\Entry::find()
+ ->ancestorOf($myEntry)
+ ->all();
+```
+:::
+
+
+
+::: tip
+This can be combined with [ancestorDist](#ancestordist) if you want to limit how far away the ancestor entries can be.
+:::
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only entries that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all entries that are related to myCategoryA and myCategoryB #}
+{% set entries = craft.entries()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all entries that are related to $myCategoryA and $myCategoryB
+$entries = \craft\elements\Entry::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching entries as arrays of data, rather than [Entry](craft4:craft\elements\Entry) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch entries as arrays #}
+{% set entries = craft.entries()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch entries as arrays
+$entries = \craft\elements\Entry::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `authorGroup`
+
+Narrows the query results based on the user group the entries’ authors belong to.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | with an author in a group with a handle of `foo`.
+| `'not foo'` | not with an author in a group with a handle of `foo`.
+| `['foo', 'bar']` | with an author in a group with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with an author in a group with a handle of `foo` or `bar`.
+| a [UserGroup](craft4:craft\models\UserGroup) object | with an author in a group represented by the object.
+| an array of [UserGroup](craft4:craft\models\UserGroup) objects | with an author in a group represented by the objects.
+
+
+
+::: code
+```twig
+{# Fetch entries with an author in the Foo user group #}
+{% set entries = craft.entries()
+ .authorGroup('foo')
+ .all() %}
+```
+
+```php
+// Fetch entries with an author in the Foo user group
+$entries = \craft\elements\Entry::find()
+ ->authorGroup('foo')
+ ->all();
+```
+:::
+
+
+#### `authorGroupId`
+
+Narrows the query results based on the user group the entries’ authors belong to, per the groups’ IDs.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | with an author in a group with an ID of 1.
+| `'not 1'` | not with an author in a group with an ID of 1.
+| `[1, 2]` | with an author in a group with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an author in a group with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch entries with an author in a group with an ID of 1 #}
+{% set entries = craft.entries()
+ .authorGroupId(1)
+ .all() %}
+```
+
+```php
+// Fetch entries with an author in a group with an ID of 1
+$entries = \craft\elements\Entry::find()
+ ->authorGroupId(1)
+ ->all();
+```
+:::
+
+
+#### `authorId`
+
+Narrows the query results based on the entries’ authors.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | with an author with an ID of 1.
+| `'not 1'` | not with an author with an ID of 1.
+| `[1, 2]` | with an author with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an author with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch entries with an author with an ID of 1 #}
+{% set entries = craft.entries()
+ .authorId(1)
+ .all() %}
+```
+
+```php
+// Fetch entries with an author with an ID of 1
+$entries = \craft\elements\Entry::find()
+ ->authorId(1)
+ ->all();
+```
+:::
+
+
+#### `before`
+
+Narrows the query results to only entries that were posted before a certain date.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'2018-04-01'` | that were posted before 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted before the date represented by the object.
+| `now`/`today`/`tomorrow`/`yesterday` | that were posted before midnight of specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries posted before this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set entries = craft.entries()
+ .before(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch entries posted before this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$entries = \craft\elements\Entry::find()
+ ->before($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `collect`
+
+
+
+
+
+
+
+
+#### `dateCreated`
+
+Narrows the query results based on the entries’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set entries = craft.entries()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch entries created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$entries = \craft\elements\Entry::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the entries’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set entries = craft.entries()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch entries updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$entries = \craft\elements\Entry::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `descendantDist`
+
+Narrows the query results to only entries that are up to a certain distance away from the entry specified by [descendantOf](#descendantof).
+
+
+
+
+
+::: code
+```twig
+{# Fetch entries below this one #}
+{% set entries = craft.entries()
+ .descendantOf(myEntry)
+ .descendantDist(3)
+ .all() %}
+```
+
+```php
+// Fetch entries below this one
+$entries = \craft\elements\Entry::find()
+ ->descendantOf($myEntry)
+ ->descendantDist(3)
+ ->all();
+```
+:::
+
+
+#### `descendantOf`
+
+Narrows the query results to only entries that are descendants of another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | below the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | below the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries below this one #}
+{% set entries = craft.entries()
+ .descendantOf(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch entries below this one
+$entries = \craft\elements\Entry::find()
+ ->descendantOf($myEntry)
+ ->all();
+```
+:::
+
+
+
+::: tip
+This can be combined with [descendantDist](#descendantdist) if you want to limit how far away the descendant entries can be.
+:::
+
+
+#### `draftCreator`
+
+Narrows the query results to only drafts created by a given user.
+
+
+
+Possible values include:
+
+| Value | Fetches drafts…
+| - | -
+| `1` | created by the user with an ID of 1.
+| a [craft\elements\User](craft4:craft\elements\User) object | created by the user represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch drafts by the current user #}
+{% set entries = craft.entries()
+ .draftCreator(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch drafts by the current user
+$entries = \craft\elements\Entry::find()
+ ->draftCreator(Craft::$app->user->identity)
+ ->all();
+```
+:::
+
+
+#### `draftId`
+
+Narrows the query results based on the entries’ draft’s ID (from the `drafts` table).
+
+
+
+Possible values include:
+
+| Value | Fetches drafts…
+| - | -
+| `1` | for the draft with an ID of 1.
+
+
+
+::: code
+```twig
+{# Fetch a draft #}
+{% set entries = craft.entries()
+ .draftId(10)
+ .all() %}
+```
+
+```php
+// Fetch a draft
+$entries = \craft\elements\Entry::find()
+ ->draftId(10)
+ ->all();
+```
+:::
+
+
+#### `draftOf`
+
+Narrows the query results to only drafts of a given entry.
+
+
+
+Possible values include:
+
+| Value | Fetches drafts…
+| - | -
+| `1` | for the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | for the entry represented by the object.
+| `'*'` | for any entry
+| `false` | that aren’t associated with a published entry
+
+
+
+::: code
+```twig
+{# Fetch drafts of the entry #}
+{% set entries = craft.entries()
+ .draftOf(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch drafts of the entry
+$entries = \craft\elements\Entry::find()
+ ->draftOf($myEntry)
+ ->all();
+```
+:::
+
+
+#### `drafts`
+
+Narrows the query results to only drafts entries.
+
+
+
+
+
+::: code
+```twig
+{# Fetch a draft entry #}
+{% set entries = craft.entries()
+ .drafts()
+ .id(123)
+ .one() %}
+```
+
+```php
+// Fetch a draft entry
+$entries = \craft\elements\Entry::find()
+ ->drafts()
+ ->id(123)
+ ->one();
+```
+:::
+
+
+#### `expiryDate`
+
+Narrows the query results based on the entries’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `':empty:'` | that don’t have an expiry date.
+| `':notempty:'` | that have an expiry date.
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that expire at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set entries = craft.entries()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch entries expiring this month
+$nextMonth = (new \DateTime('first day of next month'))->format(\DateTime::ATOM);
+
+$entries = \craft\elements\Entry::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch entries in a specific order #}
+{% set entries = craft.entries()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch entries in a specific order
+$entries = \craft\elements\Entry::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `hasDescendants`
+
+Narrows the query results based on whether the entries have any descendants in their structure.
+
+
+
+(This has the opposite effect of calling [leaves](#leaves).)
+
+
+
+::: code
+```twig
+{# Fetch entries that have descendants #}
+{% set entries = craft.entries()
+ .hasDescendants()
+ .all() %}
+```
+
+```php
+// Fetch entries that have descendants
+$entries = \craft\elements\Entry::find()
+ ->hasDescendants()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the entries’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the entry by its ID #}
+{% set entry = craft.entries()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the entry by its ID
+$entry = \craft\elements\Entry::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching entries as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch entries in reverse #}
+{% set entries = craft.entries()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch entries in reverse
+$entries = \craft\elements\Entry::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `leaves`
+
+Narrows the query results based on whether the entries are “leaves” (entries with no descendants).
+
+
+
+(This has the opposite effect of calling [hasDescendants](#hasdescendants).)
+
+
+
+::: code
+```twig
+{# Fetch entries that have no descendants #}
+{% set entries = craft.entries()
+ .leaves()
+ .all() %}
+```
+
+```php
+// Fetch entries that have no descendants
+$entries = \craft\elements\Entry::find()
+ ->leaves()
+ ->all();
+```
+:::
+
+
+#### `level`
+
+Narrows the query results based on the entries’ level within the structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | with a level of 1.
+| `'not 1'` | not with a level of 1.
+| `'>= 3'` | with a level greater than or equal to 3.
+| `[1, 2]` | with a level of 1 or 2
+| `['not', 1, 2]` | not with level of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch entries positioned at level 3 or above #}
+{% set entries = craft.entries()
+ .level('>= 3')
+ .all() %}
+```
+
+```php
+// Fetch entries positioned at level 3 or above
+$entries = \craft\elements\Entry::find()
+ ->level('>= 3')
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of entries that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 entries #}
+{% set entries = craft.entries()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 entries
+$entries = \craft\elements\Entry::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `nextSiblingOf`
+
+Narrows the query results to only the entry that comes immediately after another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches the entry…
+| - | -
+| `1` | after the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | after the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the next entry #}
+{% set entry = craft.entries()
+ .nextSiblingOf(myEntry)
+ .one() %}
+```
+
+```php
+// Fetch the next entry
+$entry = \craft\elements\Entry::find()
+ ->nextSiblingOf($myEntry)
+ ->one();
+```
+:::
+
+
+#### `offset`
+
+Determines how many entries should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all entries except for the first 3 #}
+{% set entries = craft.entries()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all entries except for the first 3
+$entries = \craft\elements\Entry::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the entries should be returned in. (If empty, defaults to `postDate DESC`, or the order defined by the section if the [section](#section) or [sectionId](#sectionid) params are set to a single Structure section.)
+
+
+
+::: code
+```twig
+{# Fetch all entries in order of date created #}
+{% set entries = craft.entries()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all entries in order of date created
+$entries = \craft\elements\Entry::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `positionedAfter`
+
+Narrows the query results to only entries that are positioned after another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | after the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | after the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries after this one #}
+{% set entries = craft.entries()
+ .positionedAfter(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch entries after this one
+$entries = \craft\elements\Entry::find()
+ ->positionedAfter($myEntry)
+ ->all();
+```
+:::
+
+
+#### `positionedBefore`
+
+Narrows the query results to only entries that are positioned before another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | before the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | before the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries before this one #}
+{% set entries = craft.entries()
+ .positionedBefore(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch entries before this one
+$entries = \craft\elements\Entry::find()
+ ->positionedBefore($myEntry)
+ ->all();
+```
+:::
+
+
+#### `postDate`
+
+Narrows the query results based on the entries’ post dates.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'>= 2018-04-01'` | that were posted on or after 2018-04-01.
+| `'< 2018-05-01'` | that were posted before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were posted between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were posted at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch entries posted last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set entries = craft.entries()
+ .postDate(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch entries posted last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$entries = \craft\elements\Entry::find()
+ ->postDate(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique entries from Site A, or Site B if they don’t exist in Site A #}
+{% set entries = craft.entries()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique entries from Site A, or Site B if they don’t exist in Site A
+$entries = \craft\elements\Entry::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `prevSiblingOf`
+
+Narrows the query results to only the entry that comes immediately before another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches the entry…
+| - | -
+| `1` | before the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | before the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the previous entry #}
+{% set entry = craft.entries()
+ .prevSiblingOf(myEntry)
+ .one() %}
+```
+
+```php
+// Fetch the previous entry
+$entry = \craft\elements\Entry::find()
+ ->prevSiblingOf($myEntry)
+ ->one();
+```
+:::
+
+
+#### `provisionalDrafts`
+
+Narrows the query results to only provisional drafts.
+
+
+
+
+
+::: code
+```twig
+{# Fetch provisional drafts created by the current user #}
+{% set entries = craft.entries()
+ .provisionalDrafts()
+ .draftCreator(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch provisional drafts created by the current user
+$entries = \craft\elements\Entry::find()
+ ->provisionalDrafts()
+ ->draftCreator(Craft::$app->user->identity)
+ ->all();
+```
+:::
+
+
+#### `relatedTo`
+
+Narrows the query results to only entries that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all entries that are related to myCategory #}
+{% set entries = craft.entries()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all entries that are related to $myCategory
+$entries = \craft\elements\Entry::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `revisionCreator`
+
+Narrows the query results to only revisions created by a given user.
+
+
+
+Possible values include:
+
+| Value | Fetches revisions…
+| - | -
+| `1` | created by the user with an ID of 1.
+| a [craft\elements\User](craft4:craft\elements\User) object | created by the user represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch revisions by the current user #}
+{% set entries = craft.entries()
+ .revisionCreator(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch revisions by the current user
+$entries = \craft\elements\Entry::find()
+ ->revisionCreator(Craft::$app->user->identity)
+ ->all();
+```
+:::
+
+
+#### `revisionId`
+
+Narrows the query results based on the entries’ revision’s ID (from the `revisions` table).
+
+
+
+Possible values include:
+
+| Value | Fetches revisions…
+| - | -
+| `1` | for the revision with an ID of 1.
+
+
+
+::: code
+```twig
+{# Fetch a revision #}
+{% set entries = craft.entries()
+ .revisionId(10)
+ .all() %}
+```
+
+```php
+// Fetch a revision
+$entries = \craft\elements\Entry::find()
+ ->revisionIf(10)
+ ->all();
+```
+:::
+
+
+#### `revisionOf`
+
+Narrows the query results to only revisions of a given entry.
+
+
+
+Possible values include:
+
+| Value | Fetches revisions…
+| - | -
+| `1` | for the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | for the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch revisions of the entry #}
+{% set entries = craft.entries()
+ .revisionOf(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch revisions of the entry
+$entries = \craft\elements\Entry::find()
+ ->revisionOf($myEntry)
+ ->all();
+```
+:::
+
+
+#### `revisions`
+
+Narrows the query results to only revision entries.
+
+
+
+
+
+::: code
+```twig
+{# Fetch a revision entry #}
+{% set entries = craft.entries()
+ .revisions()
+ .id(123)
+ .one() %}
+```
+
+```php
+// Fetch a revision entry
+$entries = \craft\elements\Entry::find()
+ ->revisions()
+ ->id(123)
+ ->one();
+```
+:::
+
+
+#### `savable`
+
+Sets the [savable](https://docs.craftcms.com/api/v3/craft-elements-db-entryquery.html#savable) property.
+
+
+
+
+
+
+#### `savedDraftsOnly`
+
+Narrows the query results to only unpublished drafts which have been saved after initial creation.
+
+
+
+
+
+::: code
+```twig
+{# Fetch saved, unpublished draft entries #}
+{% set entries = craft.entries()
+ .draftOf(false)
+ .savedDraftsOnly()
+ .all() %}
+```
+
+```php
+// Fetch saved, unpublished draft entries
+$entries = \craft\elements\Entry::find()
+ ->draftOf(false)
+ ->savedDraftsOnly()
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only entries that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all entries that match the search query #}
+{% set entries = craft.entries()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all entries that match the search query
+$entries = \craft\elements\Entry::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `section`
+
+Narrows the query results based on the sections the entries belong to.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | in a section with a handle of `foo`.
+| `'not foo'` | not in a section with a handle of `foo`.
+| `['foo', 'bar']` | in a section with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a section with a handle of `foo` or `bar`.
+| a [Section](craft4:craft\models\Section) object | in a section represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries in the Foo section #}
+{% set entries = craft.entries()
+ .section('foo')
+ .all() %}
+```
+
+```php
+// Fetch entries in the Foo section
+$entries = \craft\elements\Entry::find()
+ ->section('foo')
+ ->all();
+```
+:::
+
+
+#### `sectionId`
+
+Narrows the query results based on the sections the entries belong to, per the sections’ IDs.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | in a section with an ID of 1.
+| `'not 1'` | not in a section with an ID of 1.
+| `[1, 2]` | in a section with an ID of 1 or 2.
+| `['not', 1, 2]` | not in a section with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch entries in the section with an ID of 1 #}
+{% set entries = craft.entries()
+ .sectionId(1)
+ .all() %}
+```
+
+```php
+// Fetch entries in the section with an ID of 1
+$entries = \craft\elements\Entry::find()
+ ->sectionId(1)
+ ->all();
+```
+:::
+
+
+#### `siblingOf`
+
+Narrows the query results to only entries that are siblings of another entry in its structure.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | beside the entry with an ID of 1.
+| a [Entry](craft4:craft\elements\Entry) object | beside the entry represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries beside this one #}
+{% set entries = craft.entries()
+ .siblingOf(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch entries beside this one
+$entries = \craft\elements\Entry::find()
+ ->siblingOf($myEntry)
+ ->all();
+```
+:::
+
+
+#### `site`
+
+Determines which site(s) the entries should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](craft4:craft\models\Site) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch entries from the Foo site #}
+{% set entries = craft.entries()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch entries from the Foo site
+$entries = \craft\elements\Entry::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+#### `siteId`
+
+Determines which site(s) the entries should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch entries from the site with an ID of 1 #}
+{% set entries = craft.entries()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch entries from the site with an ID of 1
+$entries = \craft\elements\Entry::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the entries’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the entry by its ID in the elements_sites table #}
+{% set entry = craft.entries()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the entry by its ID in the elements_sites table
+$entry = \craft\elements\Entry::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `slug`
+
+Narrows the query results based on the entries’ slugs.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | with a slug of `foo`.
+| `'foo*'` | with a slug that begins with `foo`.
+| `'*foo'` | with a slug that ends with `foo`.
+| `'*foo*'` | with a slug that contains `foo`.
+| `'not *foo*'` | with a slug that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a slug that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a slug that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested entry slug from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the entry with that slug #}
+{% set entry = craft.entries()
+ .slug(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested entry slug from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the entry with that slug
+$entry = \craft\elements\Entry::find()
+ ->slug(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+#### `status`
+
+Narrows the query results based on the entries’ statuses.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'live'` _(default)_ | that are live.
+| `'pending'` | that are pending (enabled with a Post Date in the future).
+| `'expired'` | that are expired (enabled with an Expiry Date in the past).
+| `'disabled'` | that are disabled.
+| `['live', 'pending']` | that are live or pending.
+| `['not', 'live', 'pending']` | that are not live or pending.
+
+
+
+::: code
+```twig
+{# Fetch disabled entries #}
+{% set entries = craft.entries()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled entries
+$entries = \craft\elements\Entry::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+#### `title`
+
+Narrows the query results based on the entries’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch entries with a title that contains "Foo" #}
+{% set entries = craft.entries()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch entries with a title that contains "Foo"
+$entries = \craft\elements\Entry::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only entries that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed entries #}
+{% set entries = craft.entries()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed entries
+$entries = \craft\elements\Entry::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `type`
+
+Narrows the query results based on the entries’ entry types.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | of a type with a handle of `foo`.
+| `'not foo'` | not of a type with a handle of `foo`.
+| `['foo', 'bar']` | of a type with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a type with a handle of `foo` or `bar`.
+| an [EntryType](craft4:craft\models\EntryType) object | of a type represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch entries in the Foo section with a Bar entry type #}
+{% set entries = craft.entries()
+ .section('foo')
+ .type('bar')
+ .all() %}
+```
+
+```php
+// Fetch entries in the Foo section with a Bar entry type
+$entries = \craft\elements\Entry::find()
+ ->section('foo')
+ ->type('bar')
+ ->all();
+```
+:::
+
+
+#### `typeId`
+
+Narrows the query results based on the entries’ entry types, per the types’ IDs.
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `1` | of a type with an ID of 1.
+| `'not 1'` | not of a type with an ID of 1.
+| `[1, 2]` | of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a type with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch entries of the entry type with an ID of 1 #}
+{% set entries = craft.entries()
+ .typeId(1)
+ .all() %}
+```
+
+```php
+// Fetch entries of the entry type with an ID of 1
+$entries = \craft\elements\Entry::find()
+ ->typeId(1)
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the entries’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the entry by its UID #}
+{% set entry = craft.entries()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the entry by its UID
+$entry = \craft\elements\Entry::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique entries across all sites #}
+{% set entries = craft.entries()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique entries across all sites
+$entries = \craft\elements\Entry::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+#### `uri`
+
+Narrows the query results based on the entries’ URIs.
+
+
+
+Possible values include:
+
+| Value | Fetches entries…
+| - | -
+| `'foo'` | with a URI of `foo`.
+| `'foo*'` | with a URI that begins with `foo`.
+| `'*foo'` | with a URI that ends with `foo`.
+| `'*foo*'` | with a URI that contains `foo`.
+| `'not *foo*'` | with a URI that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a URI that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a URI that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested URI #}
+{% set requestedUri = craft.app.request.getPathInfo() %}
+
+{# Fetch the entry with that URI #}
+{% set entry = craft.entries()
+ .uri(requestedUri|literal)
+ .one() %}
+```
+
+```php
+// Get the requested URI
+$requestedUri = \Craft::$app->request->getPathInfo();
+
+// Fetch the entry with that URI
+$entry = \craft\elements\Entry::find()
+ ->uri(\craft\helpers\Db::escapeParam($requestedUri))
+ ->one();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching entries eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch entries eager-loaded with the "Related" field’s relations #}
+{% set entries = craft.entries()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch entries eager-loaded with the "Related" field’s relations
+$entries = \craft\elements\Entry::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/4.x/event-data/events.json b/docs/.artifacts/cms/4.x/events.json
similarity index 99%
rename from docs/4.x/event-data/events.json
rename to docs/.artifacts/cms/4.x/events.json
index 96f97f750..7afaf3f70 100644
--- a/docs/4.x/event-data/events.json
+++ b/docs/.artifacts/cms/4.x/events.json
@@ -28337,6 +28337,138 @@
"type": "yii\\base\\Event",
"desc": "an event raised at the end of `validate()`"
},
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_ELEMENT_SAVE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered before the element is saved."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_ELEMENT_SAVE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered after the element is saved."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_ELEMENT_PROPAGATE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered after the element is fully saved and propagated to other sites."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_ELEMENT_DELETE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered before the element is deleted."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_ELEMENT_DELETE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered after the element is deleted."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_ELEMENT_RESTORE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered before the element is restored."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_ELEMENT_RESTORE",
+ "type": "craft\\events\\FieldElementEvent",
+ "desc": "The event that is triggered after the element is restored."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_KEYWORDS",
+ "type": "craft\\events\\DefineFieldKeywordsEvent",
+ "desc": "The event that is triggered when defining the field’s search keywords for an element."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_INPUT_HTML",
+ "type": "craft\\events\\DefineFieldHtmlEvent",
+ "desc": "The event that is triggered when defining the field’s input HTML."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_SAVE",
+ "type": "craft\\events\\ModelEvent",
+ "desc": "The event that is triggered before the component is saved."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_SAVE",
+ "type": "craft\\events\\ModelEvent",
+ "desc": "The event that is triggered after the component is saved."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_DELETE",
+ "type": "craft\\events\\ModelEvent",
+ "desc": "The event that is triggered before the component is deleted."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_APPLY_DELETE",
+ "type": "craft\\events\\ModelEvent",
+ "desc": "The event that is triggered before the delete is applied to the database."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_DELETE",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the component is deleted."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_SETTINGS_ATTRIBUTES",
+ "type": "craft\\events\\DefineValueEvent",
+ "desc": "The event that is triggered when defining the component’s settings attributes, as returned by `settingsAttributes()`."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\fields\\Country",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
{
"class": "craft\\fields\\Date",
"name": "EVENT_BEFORE_ELEMENT_SAVE",
@@ -30623,6 +30755,48 @@
"type": "yii\\base\\Event",
"desc": "an event raised at the end of `validate()`"
},
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\fields\\conditions\\CountryFieldConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
{
"class": "craft\\fields\\conditions\\DateFieldConditionRule",
"name": "EVENT_INIT",
@@ -37306,6 +37480,12 @@
}
}
},
+ {
+ "class": "craft\\services\\Elements",
+ "name": "EVENT_SET_ELEMENT_URI",
+ "type": "craft\\events\\ElementEvent",
+ "desc": "The event that is triggered when setting a unique URI on an element."
+ },
{
"class": "craft\\services\\Elements",
"name": "EVENT_BEFORE_UPDATE_SEARCH_INDEX",
@@ -37530,6 +37710,12 @@
"type": "craft\\events\\RegisterComponentTypesEvent",
"desc": "The event that is triggered when registering field types."
},
+ {
+ "class": "craft\\services\\Fields",
+ "name": "EVENT_DEFINE_COMPATIBLE_FIELD_TYPES",
+ "type": "craft\\events\\DefineCompatibleFieldTypesEvent",
+ "desc": "The event that is triggered when defining the compatible field types for a field."
+ },
{
"class": "craft\\services\\Fields",
"name": "EVENT_BEFORE_SAVE_FIELD_GROUP",
@@ -38244,6 +38430,12 @@
"type": "craft\\events\\UserGroupsAssignEvent",
"desc": "The event that is triggered after a user is assigned to some user groups."
},
+ {
+ "class": "craft\\services\\Users",
+ "name": "EVENT_DEFINE_DEFAULT_USER_GROUPS",
+ "type": "craft\\events\\DefineUserGroupsEvent",
+ "desc": "The event that is triggered when defining the default user groups to assign to a publicly-registered user."
+ },
{
"class": "craft\\services\\Users",
"name": "EVENT_BEFORE_ASSIGN_USER_TO_DEFAULT_GROUP",
diff --git a/docs/.artifacts/cms/4.x/globals.md b/docs/.artifacts/cms/4.x/globals.md
new file mode 100644
index 000000000..3e9917bbd
--- /dev/null
+++ b/docs/.artifacts/cms/4.x/globals.md
@@ -0,0 +1,754 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only global sets that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching global sets as arrays of data, rather than [GlobalSet](craft4:craft\elements\GlobalSet) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [collect](#collect) |
+| [dateCreated](#datecreated) | Narrows the query results based on the global sets’ creation dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the global sets’ last-updated dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [handle](#handle) | Narrows the query results based on the global sets’ handles.
+| [id](#id) | Narrows the query results based on the global sets’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching global sets as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [limit](#limit) | Determines the number of global sets that should be returned.
+| [offset](#offset) | Determines how many global sets should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the global sets should be returned in. (If empty, defaults to `sortOrder ASC`.)
+| [preferSites](#prefersites) | If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [relatedTo](#relatedto) | Narrows the query results to only global sets that are related to certain other elements.
+| [search](#search) | Narrows the query results to only global sets that match a search query.
+| [site](#site) | Determines which site(s) the global sets should be queried in.
+| [siteId](#siteid) | Determines which site(s) the global sets should be queried in, per the site’s ID.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the global sets’ IDs in the `elements_sites` table.
+| [trashed](#trashed) | Narrows the query results to only global sets that have been soft-deleted.
+| [uid](#uid) | Narrows the query results based on the global sets’ UIDs.
+| [unique](#unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [with](#with) | Causes the query to return matching global sets eager-loaded with related elements.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only global sets that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all global sets that are related to myCategoryA and myCategoryB #}
+{% set globalSets = craft.globalSets()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all global sets that are related to $myCategoryA and $myCategoryB
+$globalSets = \craft\elements\GlobalSet::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching global sets as arrays of data, rather than [GlobalSet](craft4:craft\elements\GlobalSet) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch global sets as arrays #}
+{% set globalSets = craft.globalSets()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch global sets as arrays
+$globalSets = \craft\elements\GlobalSet::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `collect`
+
+
+
+
+
+
+
+
+#### `dateCreated`
+
+Narrows the query results based on the global sets’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch global sets created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set globalSets = craft.globalSets()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch global sets created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$globalSets = \craft\elements\GlobalSet::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the global sets’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch global sets updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set globalSets = craft.globalSets()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch global sets updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$globalSets = \craft\elements\GlobalSet::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch global sets in a specific order #}
+{% set globalSets = craft.globalSets()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch global sets in a specific order
+$globalSets = \craft\elements\GlobalSet::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `handle`
+
+Narrows the query results based on the global sets’ handles.
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `'foo'` | with a handle of `foo`.
+| `'not foo'` | not with a handle of `foo`.
+| `['foo', 'bar']` | with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with a handle of `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Fetch the global set with a handle of 'foo' #}
+{% set globalSet = craft.globalSets()
+ .handle('foo')
+ .one() %}
+```
+
+```php
+// Fetch the global set with a handle of 'foo'
+$globalSet = \craft\elements\GlobalSet::find()
+ ->handle('foo')
+ ->one();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the global sets’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the global set by its ID #}
+{% set globalSet = craft.globalSets()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the global set by its ID
+$globalSet = \craft\elements\GlobalSet::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching global sets as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch global sets in reverse #}
+{% set globalSets = craft.globalSets()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch global sets in reverse
+$globalSets = \craft\elements\GlobalSet::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of global sets that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 global sets #}
+{% set globalSets = craft.globalSets()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 global sets
+$globalSets = \craft\elements\GlobalSet::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `offset`
+
+Determines how many global sets should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all global sets except for the first 3 #}
+{% set globalSets = craft.globalSets()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all global sets except for the first 3
+$globalSets = \craft\elements\GlobalSet::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the global sets should be returned in. (If empty, defaults to `sortOrder ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all global sets in order of date created #}
+{% set globalSets = craft.globalSets()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all global sets in order of date created
+$globalSets = \craft\elements\GlobalSet::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique global sets from Site A, or Site B if they don’t exist in Site A #}
+{% set globalSets = craft.globalSets()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique global sets from Site A, or Site B if they don’t exist in Site A
+$globalSets = \craft\elements\GlobalSet::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `relatedTo`
+
+Narrows the query results to only global sets that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all global sets that are related to myCategory #}
+{% set globalSets = craft.globalSets()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all global sets that are related to $myCategory
+$globalSets = \craft\elements\GlobalSet::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only global sets that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all global sets that match the search query #}
+{% set globalSets = craft.globalSets()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all global sets that match the search query
+$globalSets = \craft\elements\GlobalSet::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `site`
+
+Determines which site(s) the global sets should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](craft4:craft\models\Site) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch global sets from the Foo site #}
+{% set globalSets = craft.globalSets()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch global sets from the Foo site
+$globalSets = \craft\elements\GlobalSet::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+#### `siteId`
+
+Determines which site(s) the global sets should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch global sets from the site with an ID of 1 #}
+{% set globalSets = craft.globalSets()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch global sets from the site with an ID of 1
+$globalSets = \craft\elements\GlobalSet::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the global sets’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches global sets…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the global set by its ID in the elements_sites table #}
+{% set globalSet = craft.globalSets()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the global set by its ID in the elements_sites table
+$globalSet = \craft\elements\GlobalSet::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only global sets that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed global sets #}
+{% set globalSets = craft.globalSets()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed global sets
+$globalSets = \craft\elements\GlobalSet::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the global sets’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the global set by its UID #}
+{% set globalSet = craft.globalSets()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the global set by its UID
+$globalSet = \craft\elements\GlobalSet::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique global sets across all sites #}
+{% set globalSets = craft.globalSets()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique global sets across all sites
+$globalSets = \craft\elements\GlobalSet::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching global sets eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch global sets eager-loaded with the "Related" field’s relations #}
+{% set globalSets = craft.globalSets()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch global sets eager-loaded with the "Related" field’s relations
+$globalSets = \craft\elements\GlobalSet::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/cms/4.x/matrix-blocks.md b/docs/.artifacts/cms/4.x/matrix-blocks.md
new file mode 100644
index 000000000..b7cd0f7b3
--- /dev/null
+++ b/docs/.artifacts/cms/4.x/matrix-blocks.md
@@ -0,0 +1,1033 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [allowOwnerDrafts](#allowownerdrafts) | Narrows the query results based on whether the Matrix blocks’ owners are drafts.
+| [allowOwnerRevisions](#allowownerrevisions) | Narrows the query results based on whether the Matrix blocks’ owners are revisions.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only Matrix blocks that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching Matrix blocks as arrays of data, rather than [MatrixBlock](craft4:craft\elements\MatrixBlock) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [collect](#collect) |
+| [dateCreated](#datecreated) | Narrows the query results based on the Matrix blocks’ creation dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the Matrix blocks’ last-updated dates.
+| [field](#field) | Narrows the query results based on the field the Matrix blocks belong to.
+| [fieldId](#fieldid) | Narrows the query results based on the field the Matrix blocks belong to, per the fields’ IDs.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [id](#id) | Narrows the query results based on the Matrix blocks’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching Matrix blocks as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [limit](#limit) | Determines the number of Matrix blocks that should be returned.
+| [offset](#offset) | Determines how many Matrix blocks should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the Matrix blocks should be returned in. (If empty, defaults to `sortOrder ASC`.)
+| [owner](#owner) | Sets the [ownerId](#ownerid) and [siteId](#siteid) parameters based on a given element.
+| [ownerId](#ownerid) | Narrows the query results based on the owner element of the Matrix blocks, per the owners’ IDs.
+| [preferSites](#prefersites) | If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [primaryOwner](#primaryowner) | Sets the [primaryOwnerId](#primaryownerid) and [siteId](#siteid) parameters based on a given element.
+| [primaryOwnerId](#primaryownerid) | Narrows the query results based on the primary owner element of the Matrix blocks, per the owners’ IDs.
+| [relatedTo](#relatedto) | Narrows the query results to only Matrix blocks that are related to certain other elements.
+| [search](#search) | Narrows the query results to only Matrix blocks that match a search query.
+| [site](#site) | Determines which site(s) the Matrix blocks should be queried in.
+| [siteId](#siteid) | Determines which site(s) the Matrix blocks should be queried in, per the site’s ID.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the Matrix blocks’ IDs in the `elements_sites` table.
+| [status](#status) | Narrows the query results based on the Matrix blocks’ statuses.
+| [trashed](#trashed) | Narrows the query results to only Matrix blocks that have been soft-deleted.
+| [type](#type) | Narrows the query results based on the Matrix blocks’ block types.
+| [typeId](#typeid) | Narrows the query results based on the Matrix blocks’ block types, per the types’ IDs.
+| [uid](#uid) | Narrows the query results based on the Matrix blocks’ UIDs.
+| [unique](#unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [with](#with) | Causes the query to return matching Matrix blocks eager-loaded with related elements.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `allowOwnerDrafts`
+
+Narrows the query results based on whether the Matrix blocks’ owners are drafts.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `true` | which can belong to a draft.
+| `false` | which cannot belong to a draft.
+
+
+
+
+#### `allowOwnerRevisions`
+
+Narrows the query results based on whether the Matrix blocks’ owners are revisions.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `true` | which can belong to a revision.
+| `false` | which cannot belong to a revision.
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only Matrix blocks that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all Matrix blocks that are related to myCategoryA and myCategoryB #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all Matrix blocks that are related to $myCategoryA and $myCategoryB
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching Matrix blocks as arrays of data, rather than [MatrixBlock](craft4:craft\elements\MatrixBlock) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks as arrays #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks as arrays
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `collect`
+
+
+
+
+
+
+
+
+#### `dateCreated`
+
+Narrows the query results based on the Matrix blocks’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set MatrixBlocks = craft.matrixBlocks()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the Matrix blocks’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set MatrixBlocks = craft.matrixBlocks()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `field`
+
+Narrows the query results based on the field the Matrix blocks belong to.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'foo'` | in a field with a handle of `foo`.
+| `'not foo'` | not in a field with a handle of `foo`.
+| `['foo', 'bar']` | in a field with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a field with a handle of `foo` or `bar`.
+| a [craft\fields\Matrix](craft4:craft\fields\Matrix) object | in a field represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks in the Foo field #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .field('foo')
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks in the Foo field
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->field('foo')
+ ->all();
+```
+:::
+
+
+#### `fieldId`
+
+Narrows the query results based on the field the Matrix blocks belong to, per the fields’ IDs.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | in a field with an ID of 1.
+| `'not 1'` | not in a field with an ID of 1.
+| `[1, 2]` | in a field with an ID of 1 or 2.
+| `['not', 1, 2]` | not in a field with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks in the field with an ID of 1 #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .fieldId(1)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks in the field with an ID of 1
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->fieldId(1)
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks in a specific order #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks in a specific order
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the Matrix blocks’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the Matrix block by its ID #}
+{% set MatrixBlock = craft.matrixBlocks()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the Matrix block by its ID
+$MatrixBlock = \craft\elements\MatrixBlock::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching Matrix blocks as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks in reverse #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks in reverse
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of Matrix blocks that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 Matrix blocks #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 Matrix blocks
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `offset`
+
+Determines how many Matrix blocks should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all Matrix blocks except for the first 3 #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all Matrix blocks except for the first 3
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the Matrix blocks should be returned in. (If empty, defaults to `sortOrder ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all Matrix blocks in order of date created #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all Matrix blocks in order of date created
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `owner`
+
+Sets the [ownerId](#ownerid) and [siteId](#siteid) parameters based on a given element.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks created for this entry #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .owner(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks created for this entry
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->owner($myEntry)
+ ->all();
+```
+:::
+
+
+#### `ownerId`
+
+Narrows the query results based on the owner element of the Matrix blocks, per the owners’ IDs.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | created for an element with an ID of 1.
+| `'not 1'` | not created for an element with an ID of 1.
+| `[1, 2]` | created for an element with an ID of 1 or 2.
+| `['not', 1, 2]` | not created for an element with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks created for an element with an ID of 1 #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .ownerId(1)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks created for an element with an ID of 1
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->ownerId(1)
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique Matrix blocks from Site A, or Site B if they don’t exist in Site A #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique Matrix blocks from Site A, or Site B if they don’t exist in Site A
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `primaryOwner`
+
+Sets the [primaryOwnerId](#primaryownerid) and [siteId](#siteid) parameters based on a given element.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks created for this entry #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .primaryOwner(myEntry)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks created for this entry
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->primaryOwner($myEntry)
+ ->all();
+```
+:::
+
+
+#### `primaryOwnerId`
+
+Narrows the query results based on the primary owner element of the Matrix blocks, per the owners’ IDs.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | created for an element with an ID of 1.
+| `'not 1'` | not created for an element with an ID of 1.
+| `[1, 2]` | created for an element with an ID of 1 or 2.
+| `['not', 1, 2]` | not created for an element with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks created for an element with an ID of 1 #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .primaryOwnerId(1)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks created for an element with an ID of 1
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->primaryOwnerId(1)
+ ->all();
+```
+:::
+
+
+#### `relatedTo`
+
+Narrows the query results to only Matrix blocks that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all Matrix blocks that are related to myCategory #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all Matrix blocks that are related to $myCategory
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only Matrix blocks that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all Matrix blocks that match the search query #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all Matrix blocks that match the search query
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `site`
+
+Determines which site(s) the Matrix blocks should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](craft4:craft\models\Site) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks from the Foo site #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks from the Foo site
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+#### `siteId`
+
+Determines which site(s) the Matrix blocks should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks from the site with an ID of 1 #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks from the site with an ID of 1
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the Matrix blocks’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the Matrix block by its ID in the elements_sites table #}
+{% set MatrixBlock = craft.matrixBlocks()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the Matrix block by its ID in the elements_sites table
+$MatrixBlock = \craft\elements\MatrixBlock::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `status`
+
+Narrows the query results based on the Matrix blocks’ statuses.
+
+
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'enabled'` _(default)_ | that are enabled.
+| `'disabled'` | that are disabled.
+| `['not', 'disabled']` | that are not disabled.
+
+
+
+::: code
+```twig
+{# Fetch disabled Matrix blocks #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled Matrix blocks
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only Matrix blocks that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed Matrix blocks #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed Matrix blocks
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `type`
+
+Narrows the query results based on the Matrix blocks’ block types.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `'foo'` | of a type with a handle of `foo`.
+| `'not foo'` | not of a type with a handle of `foo`.
+| `['foo', 'bar']` | of a type with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a type with a handle of `foo` or `bar`.
+| an [MatrixBlockType](craft4:craft\models\MatrixBlockType) object | of a type represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks with a Foo block type #}
+{% set MatrixBlocks = myEntry.myMatrixField
+ .type('foo')
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks with a Foo block type
+$MatrixBlocks = $myEntry->myMatrixField
+ ->type('foo')
+ ->all();
+```
+:::
+
+
+#### `typeId`
+
+Narrows the query results based on the Matrix blocks’ block types, per the types’ IDs.
+
+Possible values include:
+
+| Value | Fetches Matrix blocks…
+| - | -
+| `1` | of a type with an ID of 1.
+| `'not 1'` | not of a type with an ID of 1.
+| `[1, 2]` | of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a type with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks of the block type with an ID of 1 #}
+{% set MatrixBlocks = myEntry.myMatrixField
+ .typeId(1)
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks of the block type with an ID of 1
+$MatrixBlocks = $myEntry->myMatrixField
+ ->typeId(1)
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the Matrix blocks’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the Matrix block by its UID #}
+{% set MatrixBlock = craft.matrixBlocks()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the Matrix block by its UID
+$MatrixBlock = \craft\elements\MatrixBlock::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique Matrix blocks across all sites #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique Matrix blocks across all sites
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching Matrix blocks eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch Matrix blocks eager-loaded with the "Related" field’s relations #}
+{% set MatrixBlocks = craft.matrixBlocks()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch Matrix blocks eager-loaded with the "Related" field’s relations
+$MatrixBlocks = \craft\elements\MatrixBlock::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/cms/4.x/tags.md b/docs/.artifacts/cms/4.x/tags.md
new file mode 100644
index 000000000..897953c18
--- /dev/null
+++ b/docs/.artifacts/cms/4.x/tags.md
@@ -0,0 +1,870 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only tags that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching tags as arrays of data, rather than [Tag](craft4:craft\elements\Tag) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [collect](#collect) |
+| [dateCreated](#datecreated) | Narrows the query results based on the tags’ creation dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the tags’ last-updated dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [group](#group) | Narrows the query results based on the tag groups the tags belong to.
+| [groupId](#groupid) | Narrows the query results based on the tag groups the tags belong to, per the groups’ IDs.
+| [id](#id) | Narrows the query results based on the tags’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching tags as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [limit](#limit) | Determines the number of tags that should be returned.
+| [offset](#offset) | Determines how many tags should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the tags should be returned in. (If empty, defaults to `title ASC`.)
+| [preferSites](#prefersites) | If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [relatedTo](#relatedto) | Narrows the query results to only tags that are related to certain other elements.
+| [search](#search) | Narrows the query results to only tags that match a search query.
+| [site](#site) | Determines which site(s) the tags should be queried in.
+| [siteId](#siteid) | Determines which site(s) the tags should be queried in, per the site’s ID.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the tags’ IDs in the `elements_sites` table.
+| [title](#title) | Narrows the query results based on the tags’ titles.
+| [trashed](#trashed) | Narrows the query results to only tags that have been soft-deleted.
+| [uid](#uid) | Narrows the query results based on the tags’ UIDs.
+| [unique](#unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [uri](#uri) | Narrows the query results based on the tags’ URIs.
+| [with](#with) | Causes the query to return matching tags eager-loaded with related elements.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only tags that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all tags that are related to myCategoryA and myCategoryB #}
+{% set tags = craft.tags()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all tags that are related to $myCategoryA and $myCategoryB
+$tags = \craft\elements\Tag::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching tags as arrays of data, rather than [Tag](craft4:craft\elements\Tag) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch tags as arrays #}
+{% set tags = craft.tags()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch tags as arrays
+$tags = \craft\elements\Tag::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `collect`
+
+
+
+
+
+
+
+
+#### `dateCreated`
+
+Narrows the query results based on the tags’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch tags created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set tags = craft.tags()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch tags created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$tags = \craft\elements\Tag::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the tags’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch tags updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set tags = craft.tags()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch tags updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$tags = \craft\elements\Tag::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch tags in a specific order #}
+{% set tags = craft.tags()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch tags in a specific order
+$tags = \craft\elements\Tag::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `group`
+
+Narrows the query results based on the tag groups the tags belong to.
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'foo'` | in a group with a handle of `foo`.
+| `'not foo'` | not in a group with a handle of `foo`.
+| `['foo', 'bar']` | in a group with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a group with a handle of `foo` or `bar`.
+| a [TagGroup](craft4:craft\models\TagGroup) object | in a group represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch tags in the Foo group #}
+{% set tags = craft.tags()
+ .group('foo')
+ .all() %}
+```
+
+```php
+// Fetch tags in the Foo group
+$tags = \craft\elements\Tag::find()
+ ->group('foo')
+ ->all();
+```
+:::
+
+
+#### `groupId`
+
+Narrows the query results based on the tag groups the tags belong to, per the groups’ IDs.
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `1` | in a group with an ID of 1.
+| `'not 1'` | not in a group with an ID of 1.
+| `[1, 2]` | in a group with an ID of 1 or 2.
+| `['not', 1, 2]` | not in a group with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch tags in the group with an ID of 1 #}
+{% set tags = craft.tags()
+ .groupId(1)
+ .all() %}
+```
+
+```php
+// Fetch tags in the group with an ID of 1
+$tags = \craft\elements\Tag::find()
+ ->groupId(1)
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the tags’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the tag by its ID #}
+{% set tag = craft.tags()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the tag by its ID
+$tag = \craft\elements\Tag::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching tags as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch tags in reverse #}
+{% set tags = craft.tags()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch tags in reverse
+$tags = \craft\elements\Tag::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of tags that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 tags #}
+{% set tags = craft.tags()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 tags
+$tags = \craft\elements\Tag::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `offset`
+
+Determines how many tags should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all tags except for the first 3 #}
+{% set tags = craft.tags()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all tags except for the first 3
+$tags = \craft\elements\Tag::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the tags should be returned in. (If empty, defaults to `title ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all tags in order of date created #}
+{% set tags = craft.tags()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all tags in order of date created
+$tags = \craft\elements\Tag::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique tags from Site A, or Site B if they don’t exist in Site A #}
+{% set tags = craft.tags()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique tags from Site A, or Site B if they don’t exist in Site A
+$tags = \craft\elements\Tag::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `relatedTo`
+
+Narrows the query results to only tags that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all tags that are related to myCategory #}
+{% set tags = craft.tags()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all tags that are related to $myCategory
+$tags = \craft\elements\Tag::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only tags that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all tags that match the search query #}
+{% set tags = craft.tags()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all tags that match the search query
+$tags = \craft\elements\Tag::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `site`
+
+Determines which site(s) the tags should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](craft4:craft\models\Site) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch tags from the Foo site #}
+{% set tags = craft.tags()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch tags from the Foo site
+$tags = \craft\elements\Tag::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+#### `siteId`
+
+Determines which site(s) the tags should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch tags from the site with an ID of 1 #}
+{% set tags = craft.tags()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch tags from the site with an ID of 1
+$tags = \craft\elements\Tag::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the tags’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the tag by its ID in the elements_sites table #}
+{% set tag = craft.tags()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the tag by its ID in the elements_sites table
+$tag = \craft\elements\Tag::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `title`
+
+Narrows the query results based on the tags’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch tags with a title that contains "Foo" #}
+{% set tags = craft.tags()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch tags with a title that contains "Foo"
+$tags = \craft\elements\Tag::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only tags that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed tags #}
+{% set tags = craft.tags()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed tags
+$tags = \craft\elements\Tag::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the tags’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the tag by its UID #}
+{% set tag = craft.tags()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the tag by its UID
+$tag = \craft\elements\Tag::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique tags across all sites #}
+{% set tags = craft.tags()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique tags across all sites
+$tags = \craft\elements\Tag::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+#### `uri`
+
+Narrows the query results based on the tags’ URIs.
+
+
+
+Possible values include:
+
+| Value | Fetches tags…
+| - | -
+| `'foo'` | with a URI of `foo`.
+| `'foo*'` | with a URI that begins with `foo`.
+| `'*foo'` | with a URI that ends with `foo`.
+| `'*foo*'` | with a URI that contains `foo`.
+| `'not *foo*'` | with a URI that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a URI that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a URI that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested URI #}
+{% set requestedUri = craft.app.request.getPathInfo() %}
+
+{# Fetch the tag with that URI #}
+{% set tag = craft.tags()
+ .uri(requestedUri|literal)
+ .one() %}
+```
+
+```php
+// Get the requested URI
+$requestedUri = \Craft::$app->request->getPathInfo();
+
+// Fetch the tag with that URI
+$tag = \craft\elements\Tag::find()
+ ->uri(\craft\helpers\Db::escapeParam($requestedUri))
+ ->one();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching tags eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch tags eager-loaded with the "Related" field’s relations #}
+{% set tags = craft.tags()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch tags eager-loaded with the "Related" field’s relations
+$tags = \craft\elements\Tag::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/cms/4.x/users.md b/docs/.artifacts/cms/4.x/users.md
new file mode 100644
index 000000000..ff6f33f2e
--- /dev/null
+++ b/docs/.artifacts/cms/4.x/users.md
@@ -0,0 +1,1069 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [admin](#admin) | Narrows the query results to only users that have admin accounts.
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only users that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching users as arrays of data, rather than [User](craft4:craft\elements\User) objects.
+| [assetUploaders](#assetuploaders) | Narrows the query results to only users that have uploaded an asset.
+| [authors](#authors) | Narrows the query results to only users that are authors of an entry.
+| [cache](#cache) | Enables query cache for this Query.
+| [can](#can) | Narrows the query results to only users that have a certain user permission, either directly on the user account or through one of their user groups.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [collect](#collect) |
+| [dateCreated](#datecreated) | Narrows the query results based on the users’ creation dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the users’ last-updated dates.
+| [email](#email) | Narrows the query results based on the users’ email addresses.
+| [firstName](#firstname) | Narrows the query results based on the users’ first names.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [fullName](#fullname) | Narrows the query results based on the users’ full names.
+| [group](#group) | Narrows the query results based on the user group the users belong to.
+| [groupId](#groupid) | Narrows the query results based on the user group the users belong to, per the groups’ IDs.
+| [hasPhoto](#hasphoto) | Narrows the query results to only users that have (or don’t have) a user photo.
+| [id](#id) | Narrows the query results based on the users’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching users as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [lastLoginDate](#lastlogindate) | Narrows the query results based on the users’ last login dates.
+| [lastName](#lastname) | Narrows the query results based on the users’ last names.
+| [limit](#limit) | Determines the number of users that should be returned.
+| [offset](#offset) | Determines how many users should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the users should be returned in. (If empty, defaults to `username ASC`.)
+| [preferSites](#prefersites) | If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [relatedTo](#relatedto) | Narrows the query results to only users that are related to certain other elements.
+| [search](#search) | Narrows the query results to only users that match a search query.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the users’ IDs in the `elements_sites` table.
+| [status](#status) | Narrows the query results based on the users’ statuses.
+| [trashed](#trashed) | Narrows the query results to only users that have been soft-deleted.
+| [uid](#uid) | Narrows the query results based on the users’ UIDs.
+| [username](#username) | Narrows the query results based on the users’ usernames.
+| [with](#with) | Causes the query to return matching users eager-loaded with related elements.
+| [withGroups](#withgroups) | Causes the query to return matching users eager-loaded with their user groups.
+
+
+
+
+
+#### `admin`
+
+Narrows the query results to only users that have admin accounts.
+
+
+
+::: code
+```twig
+{# Fetch admins #}
+{% set users = craft.users()
+ .admin()
+ .all() %}
+```
+
+```php
+// Fetch admins
+$users = \craft\elements\User::find()
+ ->admin()
+ ->all();
+```
+:::
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only users that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all users that are related to myCategoryA and myCategoryB #}
+{% set users = craft.users()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all users that are related to $myCategoryA and $myCategoryB
+$users = \craft\elements\User::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching users as arrays of data, rather than [User](craft4:craft\elements\User) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch users as arrays #}
+{% set users = craft.users()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch users as arrays
+$users = \craft\elements\User::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `assetUploaders`
+
+Narrows the query results to only users that have uploaded an asset.
+
+
+
+::: code
+```twig
+{# Fetch all users who have uploaded an asset #}
+{% set users = craft.users()
+ .assetUploaders()
+ .all() %}
+```
+
+```php
+// Fetch all users who have uploaded an asset
+$users = \craft\elements\User::find()
+ ->assetUploaders()
+ ->all();
+```
+:::
+
+
+#### `authors`
+
+Narrows the query results to only users that are authors of an entry.
+
+
+
+::: code
+```twig
+{# Fetch authors #}
+{% set users = craft.users()
+ .authors()
+ .all() %}
+```
+
+```php
+// Fetch authors
+$users = \craft\elements\User::find()
+ ->authors()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `can`
+
+Narrows the query results to only users that have a certain user permission, either directly on the user account or through one of their user groups.
+
+See [User Management](https://craftcms.com/docs/4.x/user-management.html) for a full list of available user permissions defined by Craft.
+
+
+
+::: code
+```twig
+{# Fetch users that can access the control panel #}
+{% set users = craft.users()
+ .can('accessCp')
+ .all() %}
+```
+
+```php
+// Fetch users that can access the control panel
+$users = \craft\elements\User::find()
+ ->can('accessCp')
+ ->all();
+```
+:::
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `collect`
+
+
+
+
+
+
+
+
+#### `dateCreated`
+
+Narrows the query results based on the users’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch users created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set users = craft.users()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch users created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$users = \craft\elements\User::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the users’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch users updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set users = craft.users()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch users updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$users = \craft\elements\User::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `email`
+
+Narrows the query results based on the users’ email addresses.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'me@domain.tld'` | with an email of `me@domain.tld`.
+| `'not me@domain.tld'` | not with an email of `me@domain.tld`.
+| `'*@domain.tld'` | with an email that ends with `@domain.tld`.
+
+
+
+::: code
+```twig
+{# Fetch users with a .co.uk domain on their email address #}
+{% set users = craft.users()
+ .email('*.co.uk')
+ .all() %}
+```
+
+```php
+// Fetch users with a .co.uk domain on their email address
+$users = \craft\elements\User::find()
+ ->email('*.co.uk')
+ ->all();
+```
+:::
+
+
+#### `firstName`
+
+Narrows the query results based on the users’ first names.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'Jane'` | with a first name of `Jane`.
+| `'not Jane'` | not with a first name of `Jane`.
+
+
+
+::: code
+```twig
+{# Fetch all the Jane's #}
+{% set users = craft.users()
+ .firstName('Jane')
+ .all() %}
+```
+
+```php
+// Fetch all the Jane's
+$users = \craft\elements\User::find()
+ ->firstName('Jane')
+ ->one();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch users in a specific order #}
+{% set users = craft.users()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch users in a specific order
+$users = \craft\elements\User::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `fullName`
+
+Narrows the query results based on the users’ full names.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'Jane Doe'` | with a full name of `Jane Doe`.
+| `'not Jane Doe'` | not with a full name of `Jane Doe`.
+
+
+
+::: code
+```twig
+{# Fetch all the Jane Doe's #}
+{% set users = craft.users()
+ .fullName('Jane Doe')
+ .all() %}
+```
+
+```php
+// Fetch all the Jane Doe's
+$users = \craft\elements\User::find()
+ ->fullName('JaneDoe')
+ ->one();
+```
+:::
+
+
+#### `group`
+
+Narrows the query results based on the user group the users belong to.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'foo'` | in a group with a handle of `foo`.
+| `'not foo'` | not in a group with a handle of `foo`.
+| `['foo', 'bar']` | in a group with a handle of `foo` or `bar`.
+| `['and', 'foo', 'bar']` | in both groups with handles of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a group with a handle of `foo` or `bar`.
+| a [UserGroup](craft4:craft\models\UserGroup) object | in a group represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch users in the Foo user group #}
+{% set users = craft.users()
+ .group('foo')
+ .all() %}
+```
+
+```php
+// Fetch users in the Foo user group
+$users = \craft\elements\User::find()
+ ->group('foo')
+ ->all();
+```
+:::
+
+
+#### `groupId`
+
+Narrows the query results based on the user group the users belong to, per the groups’ IDs.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `1` | in a group with an ID of 1.
+| `'not 1'` | not in a group with an ID of 1.
+| `[1, 2]` | in a group with an ID of 1 or 2.
+| `['and', 1, 2]` | in both groups with IDs of 1 or 2.
+| `['not', 1, 2]` | not in a group with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch users in a group with an ID of 1 #}
+{% set users = craft.users()
+ .groupId(1)
+ .all() %}
+```
+
+```php
+// Fetch users in a group with an ID of 1
+$users = \craft\elements\User::find()
+ ->groupId(1)
+ ->all();
+```
+:::
+
+
+#### `hasPhoto`
+
+Narrows the query results to only users that have (or don’t have) a user photo.
+
+
+
+::: code
+```twig
+{# Fetch users with photos #}
+{% set users = craft.users()
+ .hasPhoto()
+ .all() %}
+```
+
+```php
+// Fetch users without photos
+$users = \craft\elements\User::find()
+ ->hasPhoto()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the users’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the user by its ID #}
+{% set user = craft.users()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the user by its ID
+$user = \craft\elements\User::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching users as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch users in reverse #}
+{% set users = craft.users()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch users in reverse
+$users = \craft\elements\User::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `lastLoginDate`
+
+Narrows the query results based on the users’ last login dates.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'>= 2018-04-01'` | that last logged in on or after 2018-04-01.
+| `'< 2018-05-01'` | that last logged in before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that last logged in between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that last logged in at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch users that logged in recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set users = craft.users()
+ .lastLoginDate(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch users that logged in recently
+$aWeekAgo = (new \DateTime('7 days ago'))->format(\DateTime::ATOM);
+
+$users = \craft\elements\User::find()
+ ->lastLoginDate(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `lastName`
+
+Narrows the query results based on the users’ last names.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'Doe'` | with a last name of `Doe`.
+| `'not Doe'` | not with a last name of `Doe`.
+
+
+
+::: code
+```twig
+{# Fetch all the Doe's #}
+{% set users = craft.users()
+ .lastName('Doe')
+ .all() %}
+```
+
+```php
+// Fetch all the Doe's
+$users = \craft\elements\User::find()
+ ->lastName('Doe')
+ ->one();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of users that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 users #}
+{% set users = craft.users()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 users
+$users = \craft\elements\User::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `offset`
+
+Determines how many users should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all users except for the first 3 #}
+{% set users = craft.users()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all users except for the first 3
+$users = \craft\elements\User::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the users should be returned in. (If empty, defaults to `username ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all users in order of date created #}
+{% set users = craft.users()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all users in order of date created
+$users = \craft\elements\User::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique users from Site A, or Site B if they don’t exist in Site A #}
+{% set users = craft.users()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique users from Site A, or Site B if they don’t exist in Site A
+$users = \craft\elements\User::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `relatedTo`
+
+Narrows the query results to only users that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all users that are related to myCategory #}
+{% set users = craft.users()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all users that are related to $myCategory
+$users = \craft\elements\User::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only users that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all users that match the search query #}
+{% set users = craft.users()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all users that match the search query
+$users = \craft\elements\User::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the users’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the user by its ID in the elements_sites table #}
+{% set user = craft.users()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the user by its ID in the elements_sites table
+$user = \craft\elements\User::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `status`
+
+Narrows the query results based on the users’ statuses.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'inactive'` | with inactive accounts.
+| `'active'` | with active accounts.
+| `'pending'` | with accounts that are still pending activation.
+| `'credentialed'` | with either active or pending accounts.
+| `'suspended'` | with suspended accounts.
+| `'locked'` | with locked accounts (regardless of whether they’re active or suspended).
+| `['active', 'suspended']` | with active or suspended accounts.
+| `['not', 'active', 'suspended']` | without active or suspended accounts.
+
+
+
+::: code
+```twig
+{# Fetch active and locked users #}
+{% set users = craft.users()
+ .status(['active', 'locked'])
+ .all() %}
+```
+
+```php
+// Fetch active and locked users
+$users = \craft\elements\User::find()
+ ->status(['active', 'locked'])
+ ->all();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only users that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed users #}
+{% set users = craft.users()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed users
+$users = \craft\elements\User::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the users’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the user by its UID #}
+{% set user = craft.users()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the user by its UID
+$user = \craft\elements\User::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `username`
+
+Narrows the query results based on the users’ usernames.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'foo'` | with a username of `foo`.
+| `'not foo'` | not with a username of `foo`.
+
+
+
+::: code
+```twig
+{# Get the requested username #}
+{% set requestedUsername = craft.app.request.getSegment(2) %}
+
+{# Fetch that user #}
+{% set user = craft.users()
+ .username(requestedUsername|literal)
+ .one() %}
+```
+
+```php
+// Get the requested username
+$requestedUsername = \Craft::$app->request->getSegment(2);
+
+// Fetch that user
+$user = \craft\elements\User::find()
+ ->username(\craft\helpers\Db::escapeParam($requestedUsername))
+ ->one();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching users eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch users eager-loaded with the "Related" field’s relations #}
+{% set users = craft.users()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch users eager-loaded with the "Related" field’s relations
+$users = \craft\elements\User::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+#### `withGroups`
+
+Causes the query to return matching users eager-loaded with their user groups.
+
+Possible values include:
+
+| Value | Fetches users…
+| - | -
+| `'>= 2018-04-01'` | that last logged-in on or after 2018-04-01.
+| `'< 2018-05-01'` | that last logged-in before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that last logged-in between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# fetch users with their user groups #}
+{% set users = craft.users()
+ .withGroups()
+ .all() %}
+```
+
+```php
+// fetch users with their user groups
+$users = \craft\elements\User::find()
+ ->withGroups()
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/2.x/order-queries.md b/docs/.artifacts/commerce/2.x/order-queries.md
new file mode 100644
index 000000000..f6ac85416
--- /dev/null
+++ b/docs/.artifacts/commerce/2.x/order-queries.md
@@ -0,0 +1,1039 @@
+
+
+
+
+- [anyStatus](#anystatus)
+- [asArray](#asarray)
+- [customer](#customer)
+- [customerId](#customerid)
+- [dateCreated](#datecreated)
+- [dateOrdered](#dateordered)
+- [datePaid](#datepaid)
+- [dateUpdated](#dateupdated)
+- [email](#email)
+- [expiryDate](#expirydate)
+- [fixedOrder](#fixedorder)
+- [gateway](#gateway)
+- [gatewayId](#gatewayid)
+- [hasPurchasables](#haspurchasables)
+- [hasTransactions](#hastransactions)
+- [id](#id)
+- [ignorePlaceholders](#ignoreplaceholders)
+- [inReverse](#inreverse)
+- [isCompleted](#iscompleted)
+- [isPaid](#ispaid)
+- [isUnpaid](#isunpaid)
+- [limit](#limit)
+- [number](#number)
+- [offset](#offset)
+- [orderBy](#orderby)
+- [orderStatus](#orderstatus)
+- [orderStatusId](#orderstatusid)
+- [preferSites](#prefersites)
+- [reference](#reference)
+- [relatedTo](#relatedto)
+- [search](#search)
+- [shortNumber](#shortnumber)
+- [trashed](#trashed)
+- [uid](#uid)
+- [user](#user)
+- [with](#with)
+
+### `anyStatus`
+
+Clears out the [status()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all orders, regardless of status #}
+{% set orders = craft.orders()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all orders, regardless of status
+$orders = \craft\commerce\elements\Order::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+### `asArray`
+
+Causes the query to return matching orders as arrays of data, rather than [Order](commerce2:craft\commerce\elements\Order) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders as arrays #}
+{% set orders = craft.orders()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch orders as arrays
+$orders = \craft\commerce\elements\Order::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+### `customer`
+
+Narrows the query results based on the customer.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [Customer](commerce2:craft\commerce\models\Customer) object | with a customer represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customer(currentUser.customerFieldHandle)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customer($user->customerFieldHandle)
+ ->all();
+```
+:::
+
+
+### `customerId`
+
+Narrows the query results based on the customer, per their ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a customer with an ID of 1.
+| `'not 1'` | not with a customer with an ID of 1.
+| `[1, 2]` | with a customer with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a customer with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customerId(currentUser.customerFieldHandle.id)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customerId($user->customerFieldHandle->id)
+ ->all();
+```
+:::
+
+
+### `dateCreated`
+
+Narrows the query results based on the orders’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set orders = craft.orders()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch orders created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+### `dateOrdered`
+
+Narrows the query results based on the orders’ completion dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were completed on or after 2018-04-01.
+| `'< 2018-05-01'` | that were completed before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were completed recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateOrdered(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were completed recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateOrdered(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+### `datePaid`
+
+Narrows the query results based on the orders’ paid dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were paid on or after 2018-04-01.
+| `'< 2018-05-01'` | that were paid before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were paid for recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .datePaid(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were paid for recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->datePaid(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+### `dateUpdated`
+
+Narrows the query results based on the orders’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch orders updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+### `email`
+
+Narrows the query results based on the customers’ email addresses.
+
+Possible values include:
+
+| Value | Fetches orders with customers…
+| - | -
+| `'foo@bar.baz'` | with an email of `foo@bar.baz`.
+| `'not foo@bar.baz'` | not with an email of `foo@bar.baz`.
+| `'*@bar.baz'` | with an email that ends with `@bar.baz`.
+
+
+
+::: code
+```twig
+{# Fetch orders from customers with a .co.uk domain on their email address #}
+{% set orders = craft.orders()
+ .email('*.co.uk')
+ .all() %}
+```
+
+```php
+// Fetch orders from customers with a .co.uk domain on their email address
+$orders = \craft\commerce\elements\Order::find()
+ ->email('*.co.uk')
+ ->all();
+```
+:::
+
+
+### `expiryDate`
+
+Narrows the query results based on the orders’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set orders = craft.orders()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch orders expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders in a specific order #}
+{% set orders = craft.orders()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch orders in a specific order
+$orders = \craft\commerce\elements\Order::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+### `gateway`
+
+Narrows the query results based on the gateway.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [Gateway](commerce2:craft\commerce\base\Gateway) object | with a gateway represented by the object.
+
+
+
+
+### `gatewayId`
+
+Narrows the query results based on the gateway, per its ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a gateway with an ID of 1.
+| `'not 1'` | not with a gateway with an ID of 1.
+| `[1, 2]` | with a gateway with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a gateway with an ID of 1 or 2.
+
+
+
+
+### `hasPurchasables`
+
+Narrows the query results to only orders that have certain purchasables.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [PurchasableInterface](commerce2:craft\commerce\base\PurchasableInterface) object | with a purchasable represented by the object.
+| an array of [PurchasableInterface](commerce2:craft\commerce\base\PurchasableInterface) objects | with all the purchasables represented by the objects.
+
+
+
+
+### `hasTransactions`
+
+Narrows the query results to only carts that have at least one transaction.
+
+
+
+::: code
+```twig
+{# Fetch carts that have attempted payments #}
+{% set orders = craft.orders()
+ .hasTransactions()
+ .all() %}
+```
+
+```php
+// Fetch carts that have attempted payments
+$orders = \craft\commerce\elements\Order::find()
+ ->hasTransactions()
+ ->all();
+```
+:::
+
+
+### `id`
+
+Narrows the query results based on the orders’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the order by its ID #}
+{% set order = craft.orders()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the order by its ID
+$order = \craft\commerce\elements\Order::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+### `ignorePlaceholders`
+
+Causes the query to return matching orders as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders in reverse #}
+{% set orders = craft.orders()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch orders in reverse
+$orders = \craft\commerce\elements\Order::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+### `isCompleted`
+
+Narrows the query results to only orders that are completed.
+
+
+
+::: code
+```twig
+{# Fetch completed orders #}
+{% set orders = craft.orders()
+ .isCompleted()
+ .all() %}
+```
+
+```php
+// Fetch completed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isCompleted()
+ ->all();
+```
+:::
+
+
+### `isPaid`
+
+Narrows the query results to only orders that are paid.
+
+
+
+::: code
+```twig
+{# Fetch paid orders #}
+{% set orders = craft.orders()
+ .isPaid()
+ .all() %}
+```
+
+```php
+// Fetch paid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isPaid()
+ ->all();
+```
+:::
+
+
+### `isUnpaid`
+
+Narrows the query results to only orders that are not paid.
+
+
+
+::: code
+```twig
+{# Fetch unpaid orders #}
+{% set orders = craft.orders()
+ .isUnpaid()
+ .all() %}
+```
+
+```php
+// Fetch unpaid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isUnpaid()
+ ->all();
+```
+:::
+
+
+### `limit`
+
+Determines the number of orders that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 orders #}
+{% set orders = craft.orders()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 orders
+$orders = \craft\commerce\elements\Order::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+### `number`
+
+Narrows the query results based on the order number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('number') %}
+{% set order = craft.orders()
+ .number(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('number');
+$order = \craft\commerce\elements\Order::find()
+ ->number($orderNumber)
+ ->one();
+```
+:::
+
+
+### `offset`
+
+Determines how many orders should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all orders except for the first 3 #}
+{% set orders = craft.orders()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all orders except for the first 3
+$orders = \craft\commerce\elements\Order::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+### `orderBy`
+
+Determines the order that the orders should be returned in.
+
+
+
+::: code
+```twig
+{# Fetch all orders in order of date created #}
+{% set orders = craft.orders()
+ .orderBy('dateCreated asc')
+ .all() %}
+```
+
+```php
+// Fetch all orders in order of date created
+$orders = \craft\commerce\elements\Order::find()
+ ->orderBy('dateCreated asc')
+ ->all();
+```
+:::
+
+
+### `orderStatus`
+
+Narrows the query results based on the order statuses.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'foo'` | with an order status with a handle of `foo`.
+| `'not foo'` | not with an order status with a handle of `foo`.
+| `['foo', 'bar']` | with an order status with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with an order status with a handle of `foo` or `bar`.
+| a [OrderStatus](commerce2:craft\commerce\models\OrderStatus) object | with an order status represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch shipped orders #}
+{% set orders = craft.orders()
+ .orderStatus('shipped')
+ .all() %}
+```
+
+```php
+// Fetch shipped orders
+$orders = \craft\commerce\elements\Order::find()
+ ->orderStatus('shipped')
+ ->all();
+```
+:::
+
+
+### `orderStatusId`
+
+Narrows the query results based on the order statuses, per their IDs.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an order status with an ID of 1.
+| `'not 1'` | not with an order status with an ID of 1.
+| `[1, 2]` | with an order status with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an order status with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order status with an ID of 1 #}
+{% set orders = craft.orders()
+ .authorGroupId(1)
+ .all() %}
+```
+
+```php
+// Fetch orders with an order status with an ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->authorGroupId(1)
+ ->all();
+```
+:::
+
+
+### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique orders from Site A, or Site B if they don’t exist in Site A #}
+{% set orders = craft.orders()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique orders from Site A, or Site B if they don’t exist in Site A
+$orders = \craft\commerce\elements\Order::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+### `reference`
+
+Narrows the query results based on the order reference.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxx'` | with a matching order reference
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderReference = craft.app.request.getQueryParam('ref') %}
+{% set order = craft.orders()
+ .reference(orderReference)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderReference = Craft::$app->request->getQueryParam('ref');
+$order = \craft\commerce\elements\Order::find()
+ ->reference($orderReference)
+ ->one();
+```
+:::
+
+
+### `relatedTo`
+
+Narrows the query results to only orders that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all orders that are related to myCategory #}
+{% set orders = craft.orders()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all orders that are related to $myCategory
+$orders = \craft\commerce\elements\Order::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+### `search`
+
+Narrows the query results to only orders that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all orders that match the search query #}
+{% set orders = craft.orders()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all orders that match the search query
+$orders = \craft\commerce\elements\Order::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+### `shortNumber`
+
+Narrows the query results based on the order short number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('shortNumber') %}
+{% set order = craft.orders()
+ .shortNumber(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('shortNumber');
+$order = \craft\commerce\elements\Order::find()
+ ->shortNumber($orderNumber)
+ ->one();
+```
+:::
+
+
+### `trashed`
+
+Narrows the query results to only orders that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed orders #}
+{% set orders = craft.orders()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+### `uid`
+
+Narrows the query results based on the orders’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the order by its UID #}
+{% set order = craft.orders()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the order by its UID
+$order = \craft\commerce\elements\Order::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+### `user`
+
+Narrows the query results based on the customer’s user account.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a customer with a user account ID of 1.
+| a [User](https://docs.craftcms.com/api/v3/craft-elements-user.html) object | with a customer with a user account represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .user(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->user($user)
+ ->all();
+```
+:::
+
+
+### `with`
+
+Causes the query to return matching orders eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch orders eager-loaded with the "Related" field’s relations #}
+{% set orders = craft.orders()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch orders eager-loaded with the "Related" field’s relations
+$orders = \craft\commerce\elements\Order::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/2.x/product-queries.md b/docs/.artifacts/commerce/2.x/product-queries.md
new file mode 100644
index 000000000..f29320e6e
--- /dev/null
+++ b/docs/.artifacts/commerce/2.x/product-queries.md
@@ -0,0 +1,1008 @@
+
+
+
+
+- [after](#after)
+- [anyStatus](#anystatus)
+- [asArray](#asarray)
+- [availableForPurchase](#availableforpurchase)
+- [before](#before)
+- [dateCreated](#datecreated)
+- [dateUpdated](#dateupdated)
+- [expiryDate](#expirydate)
+- [fixedOrder](#fixedorder)
+- [hasVariant](#hasvariant)
+- [id](#id)
+- [ignorePlaceholders](#ignoreplaceholders)
+- [inReverse](#inreverse)
+- [limit](#limit)
+- [offset](#offset)
+- [orderBy](#orderby)
+- [postDate](#postdate)
+- [preferSites](#prefersites)
+- [relatedTo](#relatedto)
+- [search](#search)
+- [site](#site)
+- [siteId](#siteid)
+- [slug](#slug)
+- [status](#status)
+- [title](#title)
+- [trashed](#trashed)
+- [type](#type)
+- [typeId](#typeid)
+- [uid](#uid)
+- [unique](#unique)
+- [uri](#uri)
+- [with](#with)
+
+### `after`
+
+Narrows the query results to only products that were posted on or after a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted after 2018-04-01.
+| a [DateTime](http://php.net/class.datetime) object | that were posted after the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .after(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->after($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+### `anyStatus`
+
+Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all products, regardless of status #}
+{% set products = craft.products()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all products, regardless of status
+$products = \craft\commerce\elements\Product::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+### `asArray`
+
+Causes the query to return matching products as arrays of data, rather than [Product](commerce2:craft\commerce\elements\Product) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products as arrays #}
+{% set products = craft.products()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch products as arrays
+$products = \craft\commerce\elements\Product::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+### `availableForPurchase`
+
+Narrows the query results to only products that are available for purchase.
+
+
+
+::: code
+```twig
+{# Fetch products that are available for purchase #}
+{% set products = craft.products()
+ .availableForPurchase()
+ .all() %}
+```
+
+```php
+// Fetch products that are available for purchase
+$products = \craft\commerce\elements\Product::find()
+ ->availableForPurchase()
+ ->all();
+```
+:::
+
+
+### `before`
+
+Narrows the query results to only products that were posted before a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted before 2018-04-01.
+| a [DateTime](http://php.net/class.datetime) object | that were posted before the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted before this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .before(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted before this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->before($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+### `dateCreated`
+
+Narrows the query results based on the products’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+### `dateUpdated`
+
+Narrows the query results based on the products’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set products = craft.products()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch products updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+### `expiryDate`
+
+Narrows the query results based on the products’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set products = craft.products()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch products expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch products in a specific order #}
+{% set products = craft.products()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch products in a specific order
+$products = \craft\commerce\elements\Product::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+### `hasVariant`
+
+Narrows the query results to only products that have certain variants.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| a [VariantQuery](commerce2:craft\commerce\elements\db\VariantQuery) object | with variants that match the query.
+
+
+
+
+### `id`
+
+Narrows the query results based on the products’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the product by its ID #}
+{% set product = craft.products()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the product by its ID
+$product = \craft\commerce\elements\Product::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+### `ignorePlaceholders`
+
+Causes the query to return matching products as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products in reverse #}
+{% set products = craft.products()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch products in reverse
+$products = \craft\commerce\elements\Product::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+### `limit`
+
+Determines the number of products that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 products #}
+{% set products = craft.products()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 products
+$products = \craft\commerce\elements\Product::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+### `offset`
+
+Determines how many products should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all products except for the first 3 #}
+{% set products = craft.products()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all products except for the first 3
+$products = \craft\commerce\elements\Product::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+### `orderBy`
+
+Determines the order that the products should be returned in.
+
+
+
+::: code
+```twig
+{# Fetch all products in order of date created #}
+{% set products = craft.products()
+ .orderBy('dateCreated asc')
+ .all() %}
+```
+
+```php
+// Fetch all products in order of date created
+$products = \craft\commerce\elements\Product::find()
+ ->orderBy('dateCreated asc')
+ ->all();
+```
+:::
+
+
+### `postDate`
+
+Narrows the query results based on the products’ post dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were posted on or after 2018-04-01.
+| `'< 2018-05-01'` | that were posted before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were posted between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products posted last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .postDate(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products posted last month
+$start = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+$end = new \DateTime('first day of this month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->postDate(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique products from Site A, or Site B if they don’t exist in Site A #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique products from Site A, or Site B if they don’t exist in Site A
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+### `relatedTo`
+
+Narrows the query results to only products that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all products that are related to myCategory #}
+{% set products = craft.products()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all products that are related to $myCategory
+$products = \craft\commerce\elements\Product::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+### `search`
+
+Narrows the query results to only products that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all products that match the search query #}
+{% set products = craft.products()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all products that match the search query
+$products = \craft\commerce\elements\Product::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+### `site`
+
+Determines which site(s) the products should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a `\craft\commerce\elements\db\Site` object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch products from the Foo site #}
+{% set products = craft.products()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch products from the Foo site
+$products = \craft\commerce\elements\Product::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+### `siteId`
+
+Determines which site(s) the products should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+
+
+::: code
+```twig
+{# Fetch products from the site with an ID of 1 #}
+{% set products = craft.products()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch products from the site with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+### `slug`
+
+Narrows the query results based on the products’ slugs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a slug of `foo`.
+| `'foo*'` | with a slug that begins with `foo`.
+| `'*foo'` | with a slug that ends with `foo`.
+| `'*foo*'` | with a slug that contains `foo`.
+| `'not *foo*'` | with a slug that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a slug that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a slug that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested product slug from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the product with that slug #}
+{% set product = craft.products()
+ .slug(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested product slug from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the product with that slug
+$product = \craft\commerce\elements\Product::find()
+ ->slug(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+### `status`
+
+Narrows the query results based on the products’ statuses.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'live'` _(default)_ | that are live.
+| `'pending'` | that are pending (enabled with a Post Date in the future).
+| `'expired'` | that are expired (enabled with an Expiry Date in the past).
+| `'disabled'` | that are disabled.
+| `['live', 'pending']` | that are live or pending.
+
+
+
+::: code
+```twig
+{# Fetch disabled products #}
+{% set products = craft.products()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled products
+$products = \craft\commerce\elements\Product::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+### `title`
+
+Narrows the query results based on the products’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch products with a title that contains "Foo" #}
+{% set products = craft.products()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch products with a title that contains "Foo"
+$products = \craft\commerce\elements\Product::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+### `trashed`
+
+Narrows the query results to only products that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed products #}
+{% set products = craft.products()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed products
+$products = \craft\commerce\elements\Product::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+### `type`
+
+Narrows the query results based on the products’ types.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | of a type with a handle of `foo`.
+| `'not foo'` | not of a type with a handle of `foo`.
+| `['foo', 'bar']` | of a type with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a type with a handle of `foo` or `bar`.
+| an [ProductType](commerce2:craft\commerce\models\ProductType) object | of a type represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products with a Foo product type #}
+{% set products = craft.products()
+ .type('foo')
+ .all() %}
+```
+
+```php
+// Fetch products with a Foo product type
+$products = \craft\commerce\elements\Product::find()
+ ->type('foo')
+ ->all();
+```
+:::
+
+
+### `typeId`
+
+Narrows the query results based on the products’ types, per the types’ IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with an ID of 1.
+| `'not 1'` | not of a type with an ID of 1.
+| `[1, 2]` | of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a type with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch products of the product type with an ID of 1 #}
+{% set products = craft.products()
+ .typeId(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product type with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->typeId(1)
+ ->all();
+```
+:::
+
+
+### `uid`
+
+Narrows the query results based on the products’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the product by its UID #}
+{% set product = craft.products()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the product by its UID
+$product = \craft\commerce\elements\Product::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique products across all sites #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique products across all sites
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+### `uri`
+
+Narrows the query results based on the products’ URIs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a URI of `foo`.
+| `'foo*'` | with a URI that begins with `foo`.
+| `'*foo'` | with a URI that ends with `foo`.
+| `'*foo*'` | with a URI that contains `foo`.
+| `'not *foo*'` | with a URI that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a URI that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a URI that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested URI #}
+{% set requestedUri = craft.app.request.getPathInfo() %}
+
+{# Fetch the product with that URI #}
+{% set product = craft.products()
+ .uri(requestedUri|literal)
+ .one() %}
+```
+
+```php
+// Get the requested URI
+$requestedUri = \Craft::$app->request->getPathInfo();
+
+// Fetch the product with that URI
+$product = \craft\commerce\elements\Product::find()
+ ->uri(\craft\helpers\Db::escapeParam($requestedUri))
+ ->one();
+```
+:::
+
+
+### `with`
+
+Causes the query to return matching products eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch products eager-loaded with the "Related" field’s relations #}
+{% set products = craft.products()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch products eager-loaded with the "Related" field’s relations
+$products = \craft\commerce\elements\Product::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/2.x/subscription-queries.md b/docs/.artifacts/commerce/2.x/subscription-queries.md
new file mode 100644
index 000000000..8c2f89656
--- /dev/null
+++ b/docs/.artifacts/commerce/2.x/subscription-queries.md
@@ -0,0 +1,959 @@
+
+
+
+
+- [anyStatus](#anystatus)
+- [asArray](#asarray)
+- [dateCanceled](#datecanceled)
+- [dateCreated](#datecreated)
+- [dateExpired](#dateexpired)
+- [dateSuspended](#datesuspended)
+- [dateUpdated](#dateupdated)
+- [fixedOrder](#fixedorder)
+- [gatewayId](#gatewayid)
+- [hasStarted](#hasstarted)
+- [id](#id)
+- [ignorePlaceholders](#ignoreplaceholders)
+- [inReverse](#inreverse)
+- [isCanceled](#iscanceled)
+- [isExpired](#isexpired)
+- [isSuspended](#issuspended)
+- [limit](#limit)
+- [nextPaymentDate](#nextpaymentdate)
+- [offset](#offset)
+- [onTrial](#ontrial)
+- [orderBy](#orderby)
+- [orderId](#orderid)
+- [plan](#plan)
+- [planId](#planid)
+- [preferSites](#prefersites)
+- [reference](#reference)
+- [relatedTo](#relatedto)
+- [search](#search)
+- [status](#status)
+- [trashed](#trashed)
+- [trialDays](#trialdays)
+- [uid](#uid)
+- [user](#user)
+- [userId](#userid)
+- [with](#with)
+
+### `anyStatus`
+
+Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions, regardless of status #}
+{% set subscriptions = craft.subscriptions()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions, regardless of status
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+### `asArray`
+
+Causes the query to return matching subscriptions as arrays of data, rather than `\craft\commerce\elements\Subscription` objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch subscriptions as arrays #}
+{% set subscriptions = craft.subscriptions()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions as arrays
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+### `dateCanceled`
+
+Narrows the query results based on the subscriptions’ cancellation date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were canceled on or after 2018-04-01.
+| `'< 2018-05-01'` | that were canceled before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were canceled between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions that were canceled recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateCanceled(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that were canceled recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateCanceled(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+### `dateCreated`
+
+Narrows the query results based on the subscriptions’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch subscriptions created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+### `dateExpired`
+
+Narrows the query results based on the subscriptions’ expiration date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that expired on or after 2018-04-01.
+| `'< 2018-05-01'` | that expired before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that expired between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions that expired recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateExpired(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that expired recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateExpired(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+### `dateSuspended`
+
+Narrows the query results based on the subscriptions’ suspension date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were suspended on or after 2018-04-01.
+| `'< 2018-05-01'` | that were suspended before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were suspended between 2018-04-01 and 2018-05-01.
+
+
+::: code
+```twig
+{# Fetch subscriptions that were suspended recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateSuspended(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that were suspended recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateSuspended(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+### `dateUpdated`
+
+Narrows the query results based on the subscriptions’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch subscriptions in a specific order #}
+{% set subscriptions = craft.subscriptions()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions in a specific order
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+### `gatewayId`
+
+Narrows the query results based on the gateway, per its ID.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with a gateway with an ID of 1.
+| `'not 1'` | not with a gateway with an ID of 1.
+| `[1, 2]` | with a gateway with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a gateway with an ID of 1 or 2.
+
+
+
+
+### `hasStarted`
+
+Narrows the query results to only subscriptions that have started.
+
+
+
+::: code
+```twig
+{# Fetch started subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .hasStarted()
+ .all() %}
+```
+
+```php
+// Fetch started subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->hasStarted()
+ ->all();
+```
+:::
+
+
+### `id`
+
+Narrows the query results based on the subscriptions’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its ID #}
+{% set subscription = craft.subscriptions()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its ID
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+### `ignorePlaceholders`
+
+Causes the query to return matching subscriptions as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch subscriptions in reverse #}
+{% set subscriptions = craft.subscriptions()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions in reverse
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+### `isCanceled`
+
+Narrows the query results to only subscriptions that are canceled.
+
+
+
+::: code
+```twig
+{# Fetch canceled subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isCanceled()
+ .all() %}
+```
+
+```php
+// Fetch canceled subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isCanceled()
+ ->all();
+```
+:::
+
+
+### `isExpired`
+
+Narrows the query results to only subscriptions that have expired.
+
+
+
+::: code
+```twig
+{# Fetch expired subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isExpired()
+ .all() %}
+```
+
+```php
+// Fetch expired subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isExpired()
+ ->all();
+```
+:::
+
+
+### `isSuspended`
+
+Narrows the query results to only subscriptions that are suspended.
+
+
+
+::: code
+```twig
+{# Fetch suspended subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isSuspended()
+ .all() %}
+```
+
+```php
+// Fetch suspended subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isSuspended()
+ ->all();
+```
+:::
+
+
+### `limit`
+
+Determines the number of subscriptions that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+### `nextPaymentDate`
+
+Narrows the query results based on the subscriptions’ next payment dates.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | with a next payment on or after 2018-04-01.
+| `'< 2018-05-01'` | with a next payment before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | with a next payment between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions with a payment due soon #}
+{% set aWeekFromNow = date('+7 days')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .nextPaymentDate("< #{aWeekFromNow}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions with a payment due soon
+$aWeekFromNow = new \DateTime('+7 days')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->nextPaymentDate("< {$aWeekFromNow}")
+ ->all();
+```
+:::
+
+
+### `offset`
+
+Determines how many subscriptions should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions except for the first 3 #}
+{% set subscriptions = craft.subscriptions()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions except for the first 3
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+### `onTrial`
+
+Narrows the query results to only subscriptions that are on trial.
+
+
+
+::: code
+```twig
+{# Fetch trialed subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .onTrial()
+ .all() %}
+```
+
+```php
+// Fetch trialed subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isPaid()
+ ->all();
+```
+:::
+
+
+### `orderBy`
+
+Determines the order that the subscriptions should be returned in.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions in order of date created #}
+{% set subscriptions = craft.subscriptions()
+ .orderBy('dateCreated asc')
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions in order of date created
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->orderBy('dateCreated asc')
+ ->all();
+```
+:::
+
+
+### `orderId`
+
+Narrows the query results based on the order, per its ID.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an order with an ID of 1.
+| `'not 1'` | not with an order with an ID of 1.
+| `[1, 2]` | with an order with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an order with an ID of 1 or 2.
+
+
+
+
+### `plan`
+
+Narrows the query results based on the subscription plan.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'foo'` | for a plan with a handle of `foo`.
+| `['foo', 'bar']` | for plans with a handle of `foo` or `bar`.
+| a [Plan](commerce2:craft\commerce\base\Plan) object | for a plan represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch Supporter plan subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .plan('supporter')
+ .all() %}
+```
+
+```php
+// Fetch Supporter plan subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->plan('supporter')
+ ->all();
+```
+:::
+
+
+### `planId`
+
+Narrows the query results based on the subscription plans’ IDs.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | for a plan with an ID of 1.
+| `[1, 2]` | for plans with an ID of 1 or 2.
+| `['not', 1, 2]` | for plans not with an ID of 1 or 2.
+
+
+
+
+### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique subscriptions from Site A, or Site B if they don’t exist in Site A #}
+{% set subscriptions = craft.subscriptions()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique subscriptions from Site A, or Site B if they don’t exist in Site A
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+### `reference`
+
+Narrows the query results based on the reference.
+
+
+
+
+
+
+### `relatedTo`
+
+Narrows the query results to only subscriptions that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions that are related to myCategory #}
+{% set subscriptions = craft.subscriptions()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions that are related to $myCategory
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+### `search`
+
+Narrows the query results to only subscriptions that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all subscriptions that match the search query #}
+{% set subscriptions = craft.subscriptions()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all subscriptions that match the search query
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+### `status`
+
+Narrows the query results based on the subscriptions’ statuses.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'active'` _(default)_ | that are active.
+| `'expired'` | that have expired.
+
+
+
+::: code
+```twig
+{# Fetch expired subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .status('expired')
+ .all() %}
+```
+
+```php
+// Fetch expired subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->status('expired')
+ ->all();
+```
+:::
+
+
+### `trashed`
+
+Narrows the query results to only subscriptions that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+### `trialDays`
+
+Narrows the query results based on the number of trial days.
+
+
+
+
+
+
+### `uid`
+
+Narrows the query results based on the subscriptions’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its UID #}
+{% set subscription = craft.subscriptions()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its UID
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+### `user`
+
+Narrows the query results based on the subscriptions’ user accounts.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'foo'` | for a user account with a username of `foo`
+| `['foo', 'bar']` | for user accounts with a username of `foo` or `bar`.
+| a [User](https://docs.craftcms.com/api/v3/craft-elements-user.html) object | for a user account represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .user(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch the current user's subscriptions
+$user = Craft::$app->user->getIdentity();
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->user($user)
+ ->all();
+```
+:::
+
+
+### `userId`
+
+Narrows the query results based on the subscriptions’ user accounts’ IDs.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | for a user account with an ID of 1.
+| `[1, 2]` | for user accounts with an ID of 1 or 2.
+| `['not', 1, 2]` | for user accounts not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .userId(currentUser.id)
+ .all() %}
+```
+
+```php
+// Fetch the current user's subscriptions
+$user = Craft::$app->user->getIdentity();
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->userId($user->id)
+ ->all();
+```
+:::
+
+
+### `with`
+
+Causes the query to return matching subscriptions eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions eager-loaded with the "Related" field’s relations #}
+{% set subscriptions = craft.subscriptions()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch subscriptions eager-loaded with the "Related" field’s relations
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/2.x/variant-queries.md b/docs/.artifacts/commerce/2.x/variant-queries.md
new file mode 100644
index 000000000..b53fe1bfd
--- /dev/null
+++ b/docs/.artifacts/commerce/2.x/variant-queries.md
@@ -0,0 +1,890 @@
+
+
+
+
+- [anyStatus](#anystatus)
+- [asArray](#asarray)
+- [dateCreated](#datecreated)
+- [dateUpdated](#dateupdated)
+- [fixedOrder](#fixedorder)
+- [hasProduct](#hasproduct)
+- [hasSales](#hassales)
+- [hasStock](#hasstock)
+- [id](#id)
+- [ignorePlaceholders](#ignoreplaceholders)
+- [inReverse](#inreverse)
+- [isDefault](#isdefault)
+- [limit](#limit)
+- [maxQty](#maxqty)
+- [minQty](#minqty)
+- [offset](#offset)
+- [orderBy](#orderby)
+- [preferSites](#prefersites)
+- [price](#price)
+- [product](#product)
+- [productId](#productid)
+- [relatedTo](#relatedto)
+- [search](#search)
+- [site](#site)
+- [siteId](#siteid)
+- [sku](#sku)
+- [status](#status)
+- [stock](#stock)
+- [title](#title)
+- [trashed](#trashed)
+- [typeId](#typeid)
+- [uid](#uid)
+- [unique](#unique)
+- [with](#with)
+
+### `anyStatus`
+
+Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all variants, regardless of status #}
+{% set variants = craft.variants()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all variants, regardless of status
+$variants = \craft\commerce\elements\Variant::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+### `asArray`
+
+Causes the query to return matching variants as arrays of data, rather than [Variant](commerce2:craft\commerce\elements\Variant) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants as arrays #}
+{% set variants = craft.variants()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch variants as arrays
+$variants = \craft\commerce\elements\Variant::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+### `dateCreated`
+
+Narrows the query results based on the variants’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch variants created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set variants = craft.variants()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch variants created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+### `dateUpdated`
+
+Narrows the query results based on the variants’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch variants updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set variants = craft.variants()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch variants updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants in a specific order #}
+{% set variants = craft.variants()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch variants in a specific order
+$variants = \craft\commerce\elements\Variant::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+### `hasProduct`
+
+Narrows the query results to only variants for certain products.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [ProductQuery](commerce2:craft\commerce\elements\db\ProductQuery) object | for products that match the query.
+
+
+
+
+### `hasSales`
+
+Narrows the query results to only variants that are on sale.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | on sale
+| `false` | not on sale
+
+
+
+
+### `hasStock`
+
+Narrows the query results to only variants that have stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | with stock.
+| `false` | with no stock.
+
+
+
+
+### `id`
+
+Narrows the query results based on the variants’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the variant by its ID #}
+{% set variant = craft.variants()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the variant by its ID
+$variant = \craft\commerce\elements\Variant::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+### `ignorePlaceholders`
+
+Causes the query to return matching variants as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants in reverse #}
+{% set variants = craft.variants()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch variants in reverse
+$variants = \craft\commerce\elements\Variant::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+### `isDefault`
+
+Narrows the query results to only default variants.
+
+
+
+::: code
+```twig
+{# Fetch default variants #}
+{% set variants = craft.variants()
+ .isDefault()
+ .all() %}
+```
+
+```php
+// Fetch default variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->isDefault()
+ ->all();
+```
+:::
+
+
+### `limit`
+
+Determines the number of variants that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 variants #}
+{% set variants = craft.variants()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+### `maxQty`
+
+Narrows the query results based on the variants’ max quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a maxQty of 100.
+| `'>= 100'` | with a maxQty of at least 100.
+| `'< 100'` | with a maxQty of less than 100.
+
+
+
+
+### `minQty`
+
+Narrows the query results based on the variants’ min quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a minQty of 100.
+| `'>= 100'` | with a minQty of at least 100.
+| `'< 100'` | with a minQty of less than 100.
+
+
+
+
+### `offset`
+
+Determines how many variants should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all variants except for the first 3 #}
+{% set variants = craft.variants()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all variants except for the first 3
+$variants = \craft\commerce\elements\Variant::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+### `orderBy`
+
+Determines the order that the variants should be returned in.
+
+
+
+::: code
+```twig
+{# Fetch all variants in order of date created #}
+{% set variants = craft.variants()
+ .orderBy('dateCreated asc')
+ .all() %}
+```
+
+```php
+// Fetch all variants in order of date created
+$variants = \craft\commerce\elements\Variant::find()
+ ->orderBy('dateCreated asc')
+ ->all();
+```
+:::
+
+
+### `preferSites`
+
+If [unique](#unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique variants from Site A, or Site B if they don’t exist in Site A #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique variants from Site A, or Site B if they don’t exist in Site A
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+### `price`
+
+Narrows the query results based on the variants’ price.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a price of 100.
+| `'>= 100'` | with a price of at least 100.
+| `'< 100'` | with a price of less than 100.
+
+
+
+
+### `product`
+
+Narrows the query results based on the variants’ product.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [Product](commerce2:craft\commerce\elements\Product) object | for a product represented by the object.
+
+
+
+
+### `productId`
+
+Narrows the query results based on the variants’ products’ IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product with an ID of 1.
+| `[1, 2]` | for product with an ID of 1 or 2.
+| `['not', 1, 2]` | for product not with an ID of 1 or 2.
+
+
+
+
+### `relatedTo`
+
+Narrows the query results to only variants that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all variants that are related to myCategory #}
+{% set variants = craft.variants()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all variants that are related to $myCategory
+$variants = \craft\commerce\elements\Variant::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+### `search`
+
+Narrows the query results to only variants that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all variants that match the search query #}
+{% set variants = craft.variants()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all variants that match the search query
+$variants = \craft\commerce\elements\Variant::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+### `site`
+
+Determines which site(s) the variants should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a `\craft\commerce\elements\db\Site` object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch variants from the Foo site #}
+{% set variants = craft.variants()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch variants from the Foo site
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+### `siteId`
+
+Determines which site(s) the variants should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+
+
+::: code
+```twig
+{# Fetch variants from the site with an ID of 1 #}
+{% set variants = craft.variants()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch variants from the site with an ID of 1
+$variants = \craft\commerce\elements\Variant::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+### `sku`
+
+Narrows the query results based on the variants’ SKUs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | with a SKU of `foo`.
+| `'foo*'` | with a SKU that begins with `foo`.
+| `'*foo'` | with a SKU that ends with `foo`.
+| `'*foo*'` | with a SKU that contains `foo`.
+| `'not *foo*'` | with a SKU that doesn’t contain `foo`.
+| `['*foo*', '*bar*'` | with a SKU that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a SKU that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested variant SKU from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the variant with that slug #}
+{% set variant = craft.variants()
+ .sku(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested variant SKU from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the variant with that slug
+$variant = \craft\commerce\elements\Variant::find()
+ ->sku(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+### `status`
+
+Narrows the query results based on the variants’ statuses.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'enabled'` _(default)_ | that are enabled.
+| `'disabled'` | that are disabled.
+
+
+
+::: code
+```twig
+{# Fetch disabled variants #}
+{% set variants = craft.variants()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+### `stock`
+
+Narrows the query results based on the variants’ stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `0` | with no stock.
+| `'>= 5'` | with a stock of at least 5.
+| `'< 10'` | with a stock of less than 10.
+
+
+
+
+### `title`
+
+Narrows the query results based on the variants’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch variants with a title that contains "Foo" #}
+{% set variants = craft.variants()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch variants with a title that contains "Foo"
+$variants = \craft\commerce\elements\Variant::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+### `trashed`
+
+Narrows the query results to only variants that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed variants #}
+{% set variants = craft.variants()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+### `typeId`
+
+Narrows the query results based on the variants’ product types, per their IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product of a type with an ID of 1.
+| `[1, 2]` | for product of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | for product of a type not with an ID of 1 or 2.
+
+
+
+
+### `uid`
+
+Narrows the query results based on the variants’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the variant by its UID #}
+{% set variant = craft.variants()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the variant by its UID
+$variant = \craft\commerce\elements\Variant::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+### `unique`
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique variants across all sites #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique variants across all sites
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+### `with`
+
+Causes the query to return matching variants eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch variants eager-loaded with the "Related" field’s relations #}
+{% set variants = craft.variants()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch variants eager-loaded with the "Related" field’s relations
+$variants = \craft\commerce\elements\Variant::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/3.x/config.md b/docs/.artifacts/commerce/3.x/config.md
new file mode 100644
index 000000000..ab163cd7f
--- /dev/null
+++ b/docs/.artifacts/commerce/3.x/config.md
@@ -0,0 +1,788 @@
+
+
+
+
+## System
+
+### `defaultView`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'commerce/orders'`
+
+Defined by
+: [Settings::$defaultView](commerce3:craft\commerce\models\Settings::$defaultView)
+
+Since
+: 2.2
+
+
+
+Commerce’s default control panel view. (Defaults to order index.)
+
+
+
+### `emailSenderAddress`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderAddress](commerce3:craft\commerce\models\Settings::$emailSenderAddress)
+
+
+
+Default email address Commerce system messages should be sent from.
+
+If `null` (default), Craft’s [MailSettings::$fromEmail](craft3:craft\models\MailSettings::$fromEmail) will be used.
+
+
+
+### `emailSenderAddressPlaceholder`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderAddressPlaceholder](commerce3:craft\commerce\models\Settings::$emailSenderAddressPlaceholder)
+
+
+
+Placeholder value displayed for the sender address control panel settings field.
+
+If `null` (default), Craft’s [MailSettings::$fromEmail](craft3:craft\models\MailSettings::$fromEmail) will be used.
+
+
+
+### `emailSenderName`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderName](commerce3:craft\commerce\models\Settings::$emailSenderName)
+
+
+
+Default from name used for Commerce system emails.
+
+If `null` (default), Craft’s [MailSettings::$fromName](craft3:craft\models\MailSettings::$fromName) will be used.
+
+
+
+### `emailSenderNamePlaceholder`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderNamePlaceholder](commerce3:craft\commerce\models\Settings::$emailSenderNamePlaceholder)
+
+
+
+Placeholder value displayed for the sender name control panel settings field.
+
+If `null` (default), Craft’s [MailSettings::$fromName](craft3:craft\models\MailSettings::$fromName) will be used.
+
+
+
+### `showCustomerInfoTab`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$showCustomerInfoTab](commerce3:craft\commerce\models\Settings::$showCustomerInfoTab)
+
+Since
+: 3.0
+
+
+
+Whether the [customer info tab](customers.md#user-customer-info-tab) should be shown when viewing users in the control panel.
+
+
+
+## Cart
+
+### `activeCartDuration`
+
+
+
+Allowed types
+: `mixed`
+
+Default value
+: `3600` (1 hour)
+
+Defined by
+: [Settings::$activeCartDuration](commerce3:craft\commerce\models\Settings::$activeCartDuration)
+
+Since
+: 2.2
+
+
+
+How long a cart should go without being updated before it’s considered inactive.
+
+See [craft\helpers\ConfigHelper::durationInSeconds()](craft3:craft\helpers\ConfigHelper::durationInSeconds()) for a list of supported value types.
+
+
+
+### `allowCheckoutWithoutPayment`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowCheckoutWithoutPayment](commerce3:craft\commerce\models\Settings::$allowCheckoutWithoutPayment)
+
+Since
+: 3.3
+
+
+
+Whether carts are can be marked as completed without a payment.
+
+
+
+### `allowEmptyCartOnCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowEmptyCartOnCheckout](commerce3:craft\commerce\models\Settings::$allowEmptyCartOnCheckout)
+
+Since
+: 2.2
+
+
+
+Whether carts are allowed to be empty on checkout.
+
+
+
+### `autoSetCartShippingMethodOption`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$autoSetCartShippingMethodOption](commerce3:craft\commerce\models\Settings::$autoSetCartShippingMethodOption)
+
+
+
+Whether the first available shipping method option should be set automatically on carts.
+
+
+
+### `autoSetNewCartAddresses`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$autoSetNewCartAddresses](commerce3:craft\commerce\models\Settings::$autoSetNewCartAddresses)
+
+
+
+Whether the customer’s primary shipping and billing addresses should be set automatically on new carts.
+
+
+
+### `cartVariable`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'cart'`
+
+Defined by
+: [Settings::$cartVariable](commerce3:craft\commerce\models\Settings::$cartVariable)
+
+
+
+Key to be used when returning cart information in a response.
+
+
+
+### `loadCartRedirectUrl`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$loadCartRedirectUrl](commerce3:craft\commerce\models\Settings::$loadCartRedirectUrl)
+
+Since
+: 3.1
+
+
+
+Default URL to be loaded after using the [load cart controller action](orders-carts.md#loading-a-cart).
+
+If `null` (default), Craft’s default [`siteUrl`](config3:siteUrl) will be used.
+
+
+
+### `purgeInactiveCarts`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$purgeInactiveCarts](commerce3:craft\commerce\models\Settings::$purgeInactiveCarts)
+
+
+
+Whether inactive carts should automatically be deleted from the database during garbage collection.
+
+::: tip
+You can control how long a cart should go without being updated before it gets deleted [`purgeInactiveCartsDuration`](#purgeinactivecartsduration) setting.
+:::
+
+
+
+### `purgeInactiveCartsDuration`
+
+
+
+Allowed types
+: `mixed`
+
+Default value
+: `7776000` (90 days)
+
+Defined by
+: [Settings::$purgeInactiveCartsDuration](commerce3:craft\commerce\models\Settings::$purgeInactiveCartsDuration)
+
+
+
+Default length of time before inactive carts are purged. (Defaults to 90 days.)
+
+See [craft\helpers\ConfigHelper::durationInSeconds()](craft3:craft\helpers\ConfigHelper::durationInSeconds()) for a list of supported value types.
+
+
+
+### `updateCartSearchIndexes`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$updateCartSearchIndexes](commerce3:craft\commerce\models\Settings::$updateCartSearchIndexes)
+
+Since
+: 3.1.5
+
+
+
+Whether the search index for a cart should be updated when saving the cart via `commerce/cart/*` controller actions.
+
+May be set to `false` to reduce performance impact on high-traffic sites.
+
+::: warning
+Setting this to `false` will result in fewer index update queue jobs, but you’ll need to manually re-index orders to ensure up-to-date cart search results in the control panel.
+:::
+
+
+
+### `validateCartCustomFieldsOnSubmission`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$validateCartCustomFieldsOnSubmission](commerce3:craft\commerce\models\Settings::$validateCartCustomFieldsOnSubmission)
+
+Since
+: 3.0.12
+
+
+
+Whether to validate custom fields when a cart is updated.
+
+Set to `true` to allow custom content fields to return validation errors when a cart is updated.
+
+
+
+## Orders
+
+### `freeOrderPaymentStrategy`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'complete'`
+
+Defined by
+: [Settings::$freeOrderPaymentStrategy](commerce3:craft\commerce\models\Settings::$freeOrderPaymentStrategy)
+
+
+
+How Commerce should handle free orders.
+
+The default `'complete'` setting automatically completes zero-balance orders without forwarding them to the payment gateway.
+
+The `'process'` setting forwards zero-balance orders to the payment gateway for processing. This can be useful if the customer’s balance
+needs to be updated or otherwise adjusted by the payment gateway.
+
+
+
+### `minimumTotalPriceStrategy`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'default'`
+
+Defined by
+: [Settings::$minimumTotalPriceStrategy](commerce3:craft\commerce\models\Settings::$minimumTotalPriceStrategy)
+
+
+
+How Commerce should handle minimum total price for an order.
+
+Options:
+
+- `'default'` [rounds](commerce3:\craft\commerce\helpers\Currency::round()) the sum of the item subtotal and adjustments.
+- `'zero'` returns `0` if the result from `'default'` would’ve been negative; minimum order total is `0`.
+- `'shipping'` returns the total shipping cost if the `'default'` result would’ve been negative; minimum order total equals shipping amount.
+
+
+
+### `orderReferenceFormat`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'{{number[:7]}}'`
+
+Defined by
+: [Settings::$orderReferenceFormat](commerce3:craft\commerce\models\Settings::$orderReferenceFormat)
+
+
+
+Human-friendly reference number format for orders. Result must be unique.
+
+See [Order Numbers](orders-carts.md#order-numbers).
+
+
+
+### `pdfAllowRemoteImages`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$pdfAllowRemoteImages](commerce3:craft\commerce\models\Settings::$pdfAllowRemoteImages)
+
+
+
+Whether to allow non-local images in generated order PDFs.
+
+
+
+### `pdfPaperOrientation`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'portrait'`
+
+Defined by
+: [Settings::$pdfPaperOrientation](commerce3:craft\commerce\models\Settings::$pdfPaperOrientation)
+
+
+
+The orientation of the paper to use for generated order PDF files.
+
+Options are `'portrait'` and `'landscape'`.
+
+
+
+### `pdfPaperSize`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'letter'`
+
+Defined by
+: [Settings::$pdfPaperSize](commerce3:craft\commerce\models\Settings::$pdfPaperSize)
+
+
+
+The size of the paper to use for generated order PDFs.
+
+The full list of supported paper sizes can be found [in the dompdf library](https://github.com/dompdf/dompdf/blob/master/src/Adapter/CPDF.php#L45).
+
+
+
+### `requireBillingAddressAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireBillingAddressAtCheckout](commerce3:craft\commerce\models\Settings::$requireBillingAddressAtCheckout)
+
+
+
+Whether a billing address is required before making payment on an order.
+
+
+
+### `requireShippingAddressAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireShippingAddressAtCheckout](commerce3:craft\commerce\models\Settings::$requireShippingAddressAtCheckout)
+
+
+
+Whether a shipping address is required before making payment on an order.
+
+
+
+### `requireShippingMethodSelectionAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireShippingMethodSelectionAtCheckout](commerce3:craft\commerce\models\Settings::$requireShippingMethodSelectionAtCheckout)
+
+
+
+Whether shipping method selection is required before making payment on an order.
+
+
+
+### `updateBillingDetailsUrl`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `''`
+
+Defined by
+: [Settings::$updateBillingDetailsUrl](commerce3:craft\commerce\models\Settings::$updateBillingDetailsUrl)
+
+
+
+URL for a user to resolve billing issues with their subscription.
+
+::: tip
+The example templates include [a template for this page](https://github.com/craftcms/commerce/tree/main/example-templates/dist/shop/plans/update-billing-details.twig).
+:::
+
+
+
+### `useBillingAddressForTax`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$useBillingAddressForTax](commerce3:craft\commerce\models\Settings::$useBillingAddressForTax)
+
+
+
+Whether taxes should be calculated based on the billing address instead of the shipping address.
+
+
+
+### `validateBusinessTaxIdAsVatId`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$validateBusinessTaxIdAsVatId](commerce3:craft\commerce\models\Settings::$validateBusinessTaxIdAsVatId)
+
+
+
+Whether to enable validation requiring the `businessTaxId` to be a valid VAT ID.
+
+When set to `false`, no validation is applied to `businessTaxId`.
+
+When set to `true`, `businessTaxId` must contain a valid VAT ID.
+
+::: tip
+This setting strictly toggles input validation and has no impact on tax configuration or behavior elsewhere in the system.
+:::
+
+
+
+## Payments
+
+### `allowPartialPaymentOnCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowPartialPaymentOnCheckout](commerce3:craft\commerce\models\Settings::$allowPartialPaymentOnCheckout)
+
+
+
+Whether [partial payment](making-payments.md#checkout-with-partial-payment) can be made from the front end when the gateway allows them.
+
+The `false` default does not allow partial payments on the front end.
+
+
+
+### `gatewayPostRedirectTemplate`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `''`
+
+Defined by
+: [Settings::$gatewayPostRedirectTemplate](commerce3:craft\commerce\models\Settings::$gatewayPostRedirectTemplate)
+
+
+
+The path to the template that should be used to perform POST requests to offsite payment gateways.
+
+The template must contain a form that posts to the URL supplied by the `actionUrl` variable and outputs all hidden inputs with
+the `inputs` variable.
+
+```twig
+
+
+
+
+ Redirecting...
+
+
+
+
+
+```
+
+::: tip
+Since this template is simply used for redirecting, it only appears for a few seconds, so we suggest making it load fast with minimal
+images and inline styles to reduce HTTP requests.
+:::
+
+If empty (default), each gateway will decide how to handle after-payment redirects.
+
+
+
+### `paymentCurrency`
+
+
+
+Allowed types
+: [array](https://php.net/language.types.array)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$paymentCurrency](commerce3:craft\commerce\models\Settings::$paymentCurrency)
+
+
+
+ISO codes for supported payment currencies.
+
+See [Payment Currencies](payment-currencies.md).
+
+
+
+## Units
+
+### `dimensionUnits`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'mm'`
+
+Defined by
+: [Settings::$dimensionUnits](commerce3:craft\commerce\models\Settings::$dimensionUnits)
+
+
+
+Unit type for dimension measurements.
+
+Options:
+
+- `'mm'`
+- `'cm'`
+- `'m'`
+- `'ft'`
+- `'in'`
+
+
+
+### `weightUnits`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'g'`
+
+Defined by
+: [Settings::$weightUnits](commerce3:craft\commerce\models\Settings::$weightUnits)
+
+
+
+Units to be used for weight measurements.
+
+Options:
+
+- `'g'`
+- `'kg'`
+- `'lb'`
+
+
+
+
+
diff --git a/docs/commerce/3.x/event-data/events.json b/docs/.artifacts/commerce/3.x/events.json
similarity index 100%
rename from docs/commerce/3.x/event-data/events.json
rename to docs/.artifacts/commerce/3.x/events.json
diff --git a/docs/.artifacts/commerce/3.x/orders-carts.md b/docs/.artifacts/commerce/3.x/orders-carts.md
new file mode 100644
index 000000000..9f3ab0dfa
--- /dev/null
+++ b/docs/.artifacts/commerce/3.x/orders-carts.md
@@ -0,0 +1,1395 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only orders that are related to certain other elements.
+| [anyStatus](#anystatus) | Removes element filters based on their statuses.
+| [asArray](#asarray) | Causes the query to return matching orders as arrays of data, rather than [Order](commerce3:craft\commerce\elements\Order) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+| [customer](#customer) | Narrows the query results based on the customer.
+| [customerId](#customerid) | Narrows the query results based on the customer, per their ID.
+| [dateAuthorized](#dateauthorized) | Narrows the query results based on the orders’ authorized dates.
+| [dateCreated](#datecreated) | Narrows the query results based on the orders’ creation dates.
+| [dateOrdered](#dateordered) | Narrows the query results based on the orders’ completion dates.
+| [datePaid](#datepaid) | Narrows the query results based on the orders’ paid dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the orders’ last-updated dates.
+| [email](#email) | Narrows the query results based on the customers’ email addresses.
+| [expiryDate](#expirydate) | Narrows the query results based on the orders’ expiry dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [gateway](#gateway) | Narrows the query results based on the gateway.
+| [gatewayId](#gatewayid) | Narrows the query results based on the gateway, per its ID.
+| [hasLineItems](#haslineitems) | Narrows the query results to only orders that have line items.
+| [hasPurchasables](#haspurchasables) | Narrows the query results to only orders that have certain purchasables.
+| [hasTransactions](#hastransactions) | Narrows the query results to only carts that have at least one transaction.
+| [id](#id) | Narrows the query results based on the orders’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching orders as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [isCompleted](#iscompleted) | Narrows the query results to only orders that are completed.
+| [isPaid](#ispaid) | Narrows the query results to only orders that are paid.
+| [isUnpaid](#isunpaid) | Narrows the query results to only orders that are not paid.
+| [limit](#limit) | Determines the number of orders that should be returned.
+| [number](#number) | Narrows the query results based on the order number.
+| [offset](#offset) | Determines how many orders should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the orders should be returned in. (If empty, defaults to `id ASC`.)
+| [orderLanguage](#orderlanguage) | Narrows the query results based on the order language, per the language string provided.
+| [orderSiteId](#ordersiteid) | Narrows the query results based on the order language, per the language string provided.
+| [orderStatus](#orderstatus) | Narrows the query results based on the order statuses.
+| [orderStatusId](#orderstatusid) | Narrows the query results based on the order statuses, per their IDs.
+| [origin](#origin) | Narrows the query results based on the origin.
+| [preferSites](#prefersites) | If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [reference](#reference) | Narrows the query results based on the order reference.
+| [relatedTo](#relatedto) | Narrows the query results to only orders that are related to certain other elements.
+| [search](#search) | Narrows the query results to only orders that match a search query.
+| [shortNumber](#shortnumber) | Narrows the query results based on the order short number.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the orders’ IDs in the `elements_sites` table.
+| [trashed](#trashed) | Narrows the query results to only orders that have been soft-deleted.
+| [uid](#uid) | Narrows the query results based on the orders’ UIDs.
+| [user](#user) | Narrows the query results based on the customer’s user account.
+| [with](#with) | Causes the query to return matching orders eager-loaded with related elements.
+| [withAddresses](#withaddresses) | Eager loads the the shipping and billing addressees on the resulting orders.
+| [withAdjustments](#withadjustments) | Eager loads the order adjustments on the resulting orders.
+| [withAll](#withall) | Eager loads all relational data (addresses, adjustents, customers, line items, transactions) for the resulting orders.
+| [withCustomer](#withcustomer) | Eager loads the customer (and related user) on the resulting orders.
+| [withLineItems](#withlineitems) | Eager loads the line items on the resulting orders.
+| [withTransactions](#withtransactions) | Eager loads the transactions on the resulting orders.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only orders that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all orders that are related to myCategoryA and myCategoryB #}
+{% set orders = craft.orders()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all orders that are related to $myCategoryA and $myCategoryB
+$orders = \craft\commerce\elements\Order::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `anyStatus`
+
+Removes element filters based on their statuses.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all orders, regardless of status #}
+{% set orders = craft.orders()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all orders, regardless of status
+$orders = \craft\commerce\elements\Order::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching orders as arrays of data, rather than [Order](commerce3:craft\commerce\elements\Order) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders as arrays #}
+{% set orders = craft.orders()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch orders as arrays
+$orders = \craft\commerce\elements\Order::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `customer`
+
+Narrows the query results based on the customer.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [Customer](commerce3:craft\commerce\models\Customer) object | with a customer represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customer(currentUser.customerFieldHandle)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customer($user->customerFieldHandle)
+ ->all();
+```
+:::
+
+
+#### `customerId`
+
+Narrows the query results based on the customer, per their ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a customer with an ID of 1.
+| `'not 1'` | not with a customer with an ID of 1.
+| `[1, 2]` | with a customer with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a customer with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customerId(currentUser.customerFieldHandle.id)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customerId($user->customerFieldHandle->id)
+ ->all();
+```
+:::
+
+
+#### `dateAuthorized`
+
+Narrows the query results based on the orders’ authorized dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were authorized on or after 2018-04-01.
+| `'< 2018-05-01'` | that were authorized before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were authorized recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateAuthorized(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were authorized recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateAuthorized(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateCreated`
+
+Narrows the query results based on the orders’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set orders = craft.orders()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch orders created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateOrdered`
+
+Narrows the query results based on the orders’ completion dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were completed on or after 2018-04-01.
+| `'< 2018-05-01'` | that were completed before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were completed recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateOrdered(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were completed recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateOrdered(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `datePaid`
+
+Narrows the query results based on the orders’ paid dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were paid on or after 2018-04-01.
+| `'< 2018-05-01'` | that were paid before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were paid for recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .datePaid(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were paid for recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->datePaid(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the orders’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch orders updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `email`
+
+Narrows the query results based on the customers’ email addresses.
+
+Possible values include:
+
+| Value | Fetches orders with customers…
+| - | -
+| `'foo@bar.baz'` | with an email of `foo@bar.baz`.
+| `'not foo@bar.baz'` | not with an email of `foo@bar.baz`.
+| `'*@bar.baz'` | with an email that ends with `@bar.baz`.
+
+
+
+::: code
+```twig
+{# Fetch orders from customers with a .co.uk domain on their email address #}
+{% set orders = craft.orders()
+ .email('*.co.uk')
+ .all() %}
+```
+
+```php
+// Fetch orders from customers with a .co.uk domain on their email address
+$orders = \craft\commerce\elements\Order::find()
+ ->email('*.co.uk')
+ ->all();
+```
+:::
+
+
+#### `expiryDate`
+
+Narrows the query results based on the orders’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set orders = craft.orders()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch orders expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders in a specific order #}
+{% set orders = craft.orders()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch orders in a specific order
+$orders = \craft\commerce\elements\Order::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `gateway`
+
+Narrows the query results based on the gateway.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [Gateway](commerce3:craft\commerce\base\Gateway) object | with a gateway represented by the object.
+
+
+
+
+#### `gatewayId`
+
+Narrows the query results based on the gateway, per its ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a gateway with an ID of 1.
+| `'not 1'` | not with a gateway with an ID of 1.
+| `[1, 2]` | with a gateway with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a gateway with an ID of 1 or 2.
+
+
+
+
+#### `hasLineItems`
+
+Narrows the query results to only orders that have line items.
+
+
+
+::: code
+```twig
+{# Fetch orders that do or do not have line items #}
+{% set orders = craft.orders()
+ .hasLineItems()
+ .all() %}
+```
+
+```php
+// Fetch unpaid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->hasLineItems()
+ ->all();
+```
+:::
+
+
+#### `hasPurchasables`
+
+Narrows the query results to only orders that have certain purchasables.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [PurchasableInterface](commerce3:craft\commerce\base\PurchasableInterface) object | with a purchasable represented by the object.
+| an array of [PurchasableInterface](commerce3:craft\commerce\base\PurchasableInterface) objects | with all the purchasables represented by the objects.
+
+
+
+
+#### `hasTransactions`
+
+Narrows the query results to only carts that have at least one transaction.
+
+
+
+::: code
+```twig
+{# Fetch carts that have attempted payments #}
+{% set orders = craft.orders()
+ .hasTransactions()
+ .all() %}
+```
+
+```php
+// Fetch carts that have attempted payments
+$orders = \craft\commerce\elements\Order::find()
+ ->hasTransactions()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the orders’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the order by its ID #}
+{% set order = craft.orders()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the order by its ID
+$order = \craft\commerce\elements\Order::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching orders as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders in reverse #}
+{% set orders = craft.orders()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch orders in reverse
+$orders = \craft\commerce\elements\Order::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `isCompleted`
+
+Narrows the query results to only orders that are completed.
+
+
+
+::: code
+```twig
+{# Fetch completed orders #}
+{% set orders = craft.orders()
+ .isCompleted()
+ .all() %}
+```
+
+```php
+// Fetch completed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isCompleted()
+ ->all();
+```
+:::
+
+
+#### `isPaid`
+
+Narrows the query results to only orders that are paid.
+
+
+
+::: code
+```twig
+{# Fetch paid orders #}
+{% set orders = craft.orders()
+ .isPaid()
+ .all() %}
+```
+
+```php
+// Fetch paid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isPaid()
+ ->all();
+```
+:::
+
+
+#### `isUnpaid`
+
+Narrows the query results to only orders that are not paid.
+
+
+
+::: code
+```twig
+{# Fetch unpaid orders #}
+{% set orders = craft.orders()
+ .isUnpaid()
+ .all() %}
+```
+
+```php
+// Fetch unpaid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isUnpaid()
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of orders that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 orders #}
+{% set orders = craft.orders()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 orders
+$orders = \craft\commerce\elements\Order::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `number`
+
+Narrows the query results based on the order number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('number') %}
+{% set order = craft.orders()
+ .number(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('number');
+$order = \craft\commerce\elements\Order::find()
+ ->number($orderNumber)
+ ->one();
+```
+:::
+
+
+#### `offset`
+
+Determines how many orders should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all orders except for the first 3 #}
+{% set orders = craft.orders()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all orders except for the first 3
+$orders = \craft\commerce\elements\Order::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the orders should be returned in. (If empty, defaults to `id ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all orders in order of date created #}
+{% set orders = craft.orders()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all orders in order of date created
+$orders = \craft\commerce\elements\Order::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `orderLanguage`
+
+Narrows the query results based on the order language, per the language string provided.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `en` | with an order language that is `'en'`.
+| `'not en'` | not with an order language that is not `'en'`.
+| `['en', 'en-us']` | with an order language that is `'en'` or `'en-us'`.
+| `['not', 'en']` | not with an order language that is not `'en'`.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order status with an ID of 1 #}
+{% set orders = craft.orders()
+ .orderLanguage('en')
+ .all() %}
+```
+
+```php
+// Fetch orders with an order status with an ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->orderLanguage('en')
+ ->all();
+```
+:::
+
+
+#### `orderSiteId`
+
+Narrows the query results based on the order language, per the language string provided.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an order site ID of 1.
+| `'not 1'` | not with an order site ID that is no 1.
+| `[1, 2]` | with an order site ID of 1 or 2.
+| `['not', 1, 2]` | not with an order site ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order site ID of 1 #}
+{% set orders = craft.orders()
+ .orderSiteId(1)
+ .all() %}
+```
+
+```php
+// Fetch orders with an order site ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->orderSiteId(1)
+ ->all();
+```
+:::
+
+
+#### `orderStatus`
+
+Narrows the query results based on the order statuses.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'foo'` | with an order status with a handle of `foo`.
+| `'not foo'` | not with an order status with a handle of `foo`.
+| `['foo', 'bar']` | with an order status with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with an order status with a handle of `foo` or `bar`.
+| a [OrderStatus](commerce3:craft\commerce\models\OrderStatus) object | with an order status represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch shipped orders #}
+{% set orders = craft.orders()
+ .orderStatus('shipped')
+ .all() %}
+```
+
+```php
+// Fetch shipped orders
+$orders = \craft\commerce\elements\Order::find()
+ ->orderStatus('shipped')
+ ->all();
+```
+:::
+
+
+#### `orderStatusId`
+
+Narrows the query results based on the order statuses, per their IDs.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an order status with an ID of 1.
+| `'not 1'` | not with an order status with an ID of 1.
+| `[1, 2]` | with an order status with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an order status with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order status with an ID of 1 #}
+{% set orders = craft.orders()
+ .orderStatusId(1)
+ .all() %}
+```
+
+```php
+// Fetch orders with an order status with an ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->orderStatusId(1)
+ ->all();
+```
+:::
+
+
+#### `origin`
+
+Narrows the query results based on the origin.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'web'` | with an origin of `web`.
+| `'not remote'` | not with an origin of `remote`.
+| `['web', 'cp']` | with an order origin of `web` or `cp`.
+| `['not', 'remote', 'cp']` | not with an origin of `web` or `cp`.
+
+
+
+::: code
+```twig
+{# Fetch shipped orders #}
+{% set orders = craft.orders()
+ .origin('web')
+ .all() %}
+```
+
+```php
+// Fetch shipped orders
+$orders = \craft\commerce\elements\Order::find()
+ ->origin('web')
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique orders from Site A, or Site B if they don’t exist in Site A #}
+{% set orders = craft.orders()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique orders from Site A, or Site B if they don’t exist in Site A
+$orders = \craft\commerce\elements\Order::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `reference`
+
+Narrows the query results based on the order reference.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxx'` | with a matching order reference
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderReference = craft.app.request.getQueryParam('ref') %}
+{% set order = craft.orders()
+ .reference(orderReference)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderReference = Craft::$app->request->getQueryParam('ref');
+$order = \craft\commerce\elements\Order::find()
+ ->reference($orderReference)
+ ->one();
+```
+:::
+
+
+#### `relatedTo`
+
+Narrows the query results to only orders that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all orders that are related to myCategory #}
+{% set orders = craft.orders()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all orders that are related to $myCategory
+$orders = \craft\commerce\elements\Order::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only orders that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all orders that match the search query #}
+{% set orders = craft.orders()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all orders that match the search query
+$orders = \craft\commerce\elements\Order::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `shortNumber`
+
+Narrows the query results based on the order short number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('shortNumber') %}
+{% set order = craft.orders()
+ .shortNumber(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('shortNumber');
+$order = \craft\commerce\elements\Order::find()
+ ->shortNumber($orderNumber)
+ ->one();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the orders’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the order by its ID in the elements_sites table #}
+{% set order = craft.orders()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the order by its ID in the elements_sites table
+$order = \craft\commerce\elements\Order::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only orders that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed orders #}
+{% set orders = craft.orders()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the orders’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the order by its UID #}
+{% set order = craft.orders()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the order by its UID
+$order = \craft\commerce\elements\Order::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `user`
+
+Narrows the query results based on the customer’s user account.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a customer with a user account ID of 1.
+| a [User](https://docs.craftcms.com/api/v3/craft-elements-user.html) object | with a customer with a user account represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .user(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->user($user)
+ ->all();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching orders eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch orders eager-loaded with the "Related" field’s relations #}
+{% set orders = craft.orders()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch orders eager-loaded with the "Related" field’s relations
+$orders = \craft\commerce\elements\Order::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+#### `withAddresses`
+
+Eager loads the the shipping and billing addressees on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches addresses
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withAdjustments`
+
+Eager loads the order adjustments on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches adjustments
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withAll`
+
+Eager loads all relational data (addresses, adjustents, customers, line items, transactions) for the resulting orders.
+
+Possible values include:
+
+| Value | Fetches addresses, adjustents, customers, line items, transactions
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withCustomer`
+
+Eager loads the customer (and related user) on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches adjustments
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withLineItems`
+
+Eager loads the line items on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches line items…
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withTransactions`
+
+Eager loads the transactions on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches transactions…
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+
+
diff --git a/docs/.artifacts/commerce/3.x/products-variants.md b/docs/.artifacts/commerce/3.x/products-variants.md
new file mode 100644
index 000000000..ba8edfa75
--- /dev/null
+++ b/docs/.artifacts/commerce/3.x/products-variants.md
@@ -0,0 +1,2577 @@
+
+
+## Product Query Parameters
+
+Product queries support the following parameters:
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [after](#product-after) | Narrows the query results to only products that were posted on or after a certain date.
+| [afterPopulate](#product-afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#product-andrelatedto) | Narrows the query results to only products that are related to certain other elements.
+| [anyStatus](#product-anystatus) | Removes element filters based on their statuses.
+| [asArray](#product-asarray) | Causes the query to return matching products as arrays of data, rather than [Product](commerce3:craft\commerce\elements\Product) objects.
+| [availableForPurchase](#product-availableforpurchase) | Narrows the query results to only products that are available for purchase.
+| [before](#product-before) | Narrows the query results to only products that were posted before a certain date.
+| [cache](#product-cache) | Enables query cache for this Query.
+| [clearCachedResult](#product-clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+| [dateCreated](#product-datecreated) | Narrows the query results based on the products’ creation dates.
+| [dateUpdated](#product-dateupdated) | Narrows the query results based on the products’ last-updated dates.
+| [defaultHeight](#product-defaultheight) | Narrows the query results based on the products’ default variant height dimension IDs.
+| [defaultLength](#product-defaultlength) | Narrows the query results based on the products’ default variant length dimension IDs.
+| [defaultPrice](#product-defaultprice) | Narrows the query results based on the products’ default variant price.
+| [defaultSku](#product-defaultsku) | Narrows the query results based on the default productvariants defaultSku
+| [defaultWeight](#product-defaultweight) | Narrows the query results based on the products’ default variant weight dimension IDs.
+| [defaultWidth](#product-defaultwidth) | Narrows the query results based on the products’ default variant width dimension IDs.
+| [expiryDate](#product-expirydate) | Narrows the query results based on the products’ expiry dates.
+| [fixedOrder](#product-fixedorder) | Causes the query results to be returned in the order specified by [id](#product-id).
+| [hasVariant](#product-hasvariant) | Narrows the query results to only products that have certain variants.
+| [id](#product-id) | Narrows the query results based on the products’ IDs.
+| [ignorePlaceholders](#product-ignoreplaceholders) | Causes the query to return matching products as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#product-inreverse) | Causes the query results to be returned in reverse order.
+| [limit](#product-limit) | Determines the number of products that should be returned.
+| [offset](#product-offset) | Determines how many products should be skipped in the results.
+| [orderBy](#product-orderby) | Determines the order that the products should be returned in. (If empty, defaults to `postDate DESC`.)
+| [postDate](#product-postdate) | Narrows the query results based on the products’ post dates.
+| [preferSites](#product-prefersites) | If [unique](#product-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [relatedTo](#product-relatedto) | Narrows the query results to only products that are related to certain other elements.
+| [search](#product-search) | Narrows the query results to only products that match a search query.
+| [site](#product-site) | Determines which site(s) the products should be queried in.
+| [siteId](#product-siteid) | Determines which site(s) the products should be queried in, per the site’s ID.
+| [siteSettingsId](#product-sitesettingsid) | Narrows the query results based on the products’ IDs in the `elements_sites` table.
+| [slug](#product-slug) | Narrows the query results based on the products’ slugs.
+| [status](#product-status) | Narrows the query results based on the products’ statuses.
+| [title](#product-title) | Narrows the query results based on the products’ titles.
+| [trashed](#product-trashed) | Narrows the query results to only products that have been soft-deleted.
+| [type](#product-type) | Narrows the query results based on the products’ types.
+| [typeId](#product-typeid) | Narrows the query results based on the products’ types, per the types’ IDs.
+| [uid](#product-uid) | Narrows the query results based on the products’ UIDs.
+| [unique](#product-unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [uri](#product-uri) | Narrows the query results based on the products’ URIs.
+| [with](#product-with) | Causes the query to return matching products eager-loaded with related elements.
+
+
+
+
+
+ after
+
+Narrows the query results to only products that were posted on or after a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted after 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted after the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .after(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->after($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+ afterPopulate
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+
+
+Narrows the query results to only products that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all products that are related to myCategoryA and myCategoryB #}
+{% set products = craft.products()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all products that are related to $myCategoryA and $myCategoryB
+$products = \craft\commerce\elements\Product::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+ anyStatus
+
+Removes element filters based on their statuses.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all products, regardless of status #}
+{% set products = craft.products()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all products, regardless of status
+$products = \craft\commerce\elements\Product::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+ asArray
+
+Causes the query to return matching products as arrays of data, rather than [Product](commerce3:craft\commerce\elements\Product) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products as arrays #}
+{% set products = craft.products()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch products as arrays
+$products = \craft\commerce\elements\Product::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+ availableForPurchase
+
+Narrows the query results to only products that are available for purchase.
+
+
+
+::: code
+```twig
+{# Fetch products that are available for purchase #}
+{% set products = craft.products()
+ .availableForPurchase()
+ .all() %}
+```
+
+```php
+// Fetch products that are available for purchase
+$products = \craft\commerce\elements\Product::find()
+ ->availableForPurchase()
+ ->all();
+```
+:::
+
+
+ before
+
+Narrows the query results to only products that were posted before a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted before 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted before the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted before this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .before(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted before this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->before($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+ cache
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+ clearCachedResult
+
+Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+
+
+
+
+
+
+ dateCreated
+
+Narrows the query results based on the products’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ dateUpdated
+
+Narrows the query results based on the products’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set products = craft.products()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch products updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+ defaultHeight
+
+Narrows the query results based on the products’ default variant height dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultHeight(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultHeight(1)
+ ->all();
+```
+:::
+
+
+ defaultLength
+
+Narrows the query results based on the products’ default variant length dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaulLength(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaulLength(1)
+ ->all();
+```
+:::
+
+
+ defaultPrice
+
+Narrows the query results based on the products’ default variant price.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `10` | of a price of 10.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a default variant price between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product type with an ID of 1 #}
+{% set products = craft.products()
+ .defaultPrice(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product type with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultPrice(1)
+ ->all();
+```
+:::
+
+
+ defaultSku
+
+Narrows the query results based on the default productvariants defaultSku
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `xxx-001` | of products defaukt SKU of `xxx-001`.
+| `'not xxx-001'` | not a defaukt SKU of `xxx-001`.
+| `['not xxx-001', 'not xxx-002']` | of a default SKU of xxx-001 or xxx-002.
+| `['not', `xxx-001`, `xxx-002`]` | not a product defaukt SKU of `xxx-001` or `xxx-001`.
+
+
+
+::: code
+```twig
+{# Fetch products of the product defaukt SKU of `xxx-001` #}
+{% set products = craft.products()
+ .defaultSku('xxx-001')
+ .all() %}
+```
+
+```php
+// Fetch products of the product defaukt SKU of `xxx-001`
+$products = \craft\commerce\elements\Product::find()
+ ->defaultSku('xxx-001')
+ ->all();
+```
+:::
+
+
+ defaultWeight
+
+Narrows the query results based on the products’ default variant weight dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultWeight(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultWeight(1)
+ ->all();
+```
+:::
+
+
+ defaultWidth
+
+Narrows the query results based on the products’ default variant width dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultWidth(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultWidth(1)
+ ->all();
+```
+:::
+
+
+ expiryDate
+
+Narrows the query results based on the products’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set products = craft.products()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch products expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+ fixedOrder
+
+Causes the query results to be returned in the order specified by [id](#product-id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch products in a specific order #}
+{% set products = craft.products()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch products in a specific order
+$products = \craft\commerce\elements\Product::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+ hasVariant
+
+Narrows the query results to only products that have certain variants.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| a [VariantQuery](commerce3:craft\commerce\elements\db\VariantQuery) object | with variants that match the query.
+
+
+
+
+ id
+
+Narrows the query results based on the products’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the product by its ID #}
+{% set product = craft.products()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the product by its ID
+$product = \craft\commerce\elements\Product::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#product-fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+ ignorePlaceholders
+
+Causes the query to return matching products as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+ inReverse
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products in reverse #}
+{% set products = craft.products()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch products in reverse
+$products = \craft\commerce\elements\Product::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+ limit
+
+Determines the number of products that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 products #}
+{% set products = craft.products()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 products
+$products = \craft\commerce\elements\Product::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+ offset
+
+Determines how many products should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all products except for the first 3 #}
+{% set products = craft.products()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all products except for the first 3
+$products = \craft\commerce\elements\Product::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+ orderBy
+
+Determines the order that the products should be returned in. (If empty, defaults to `postDate DESC`.)
+
+
+
+::: code
+```twig
+{# Fetch all products in order of date created #}
+{% set products = craft.products()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all products in order of date created
+$products = \craft\commerce\elements\Product::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+ postDate
+
+Narrows the query results based on the products’ post dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were posted on or after 2018-04-01.
+| `'< 2018-05-01'` | that were posted before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were posted between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products posted last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .postDate(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products posted last month
+$start = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+$end = new \DateTime('first day of this month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->postDate(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ preferSites
+
+If [unique](#product-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique products from Site A, or Site B if they don’t exist in Site A #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique products from Site A, or Site B if they don’t exist in Site A
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+
+
+Narrows the query results to only products that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all products that are related to myCategory #}
+{% set products = craft.products()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all products that are related to $myCategory
+$products = \craft\commerce\elements\Product::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+ search
+
+Narrows the query results to only products that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all products that match the search query #}
+{% set products = craft.products()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all products that match the search query
+$products = \craft\commerce\elements\Product::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+ site
+
+Determines which site(s) the products should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](https://docs.craftcms.com/api/v3/craft-models-site.html) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#product-unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch products from the Foo site #}
+{% set products = craft.products()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch products from the Foo site
+$products = \craft\commerce\elements\Product::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+ siteId
+
+Determines which site(s) the products should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch products from the site with an ID of 1 #}
+{% set products = craft.products()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch products from the site with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+ siteSettingsId
+
+Narrows the query results based on the products’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the product by its ID in the elements_sites table #}
+{% set product = craft.products()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the product by its ID in the elements_sites table
+$product = \craft\commerce\elements\Product::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+ slug
+
+Narrows the query results based on the products’ slugs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a slug of `foo`.
+| `'foo*'` | with a slug that begins with `foo`.
+| `'*foo'` | with a slug that ends with `foo`.
+| `'*foo*'` | with a slug that contains `foo`.
+| `'not *foo*'` | with a slug that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a slug that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a slug that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested product slug from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the product with that slug #}
+{% set product = craft.products()
+ .slug(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested product slug from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the product with that slug
+$product = \craft\commerce\elements\Product::find()
+ ->slug(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+ status
+
+Narrows the query results based on the products’ statuses.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'live'` _(default)_ | that are live.
+| `'pending'` | that are pending (enabled with a Post Date in the future).
+| `'expired'` | that are expired (enabled with an Expiry Date in the past).
+| `'disabled'` | that are disabled.
+| `['live', 'pending']` | that are live or pending.
+
+
+
+::: code
+```twig
+{# Fetch disabled products #}
+{% set products = craft.products()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled products
+$products = \craft\commerce\elements\Product::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+ title
+
+Narrows the query results based on the products’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch products with a title that contains "Foo" #}
+{% set products = craft.products()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch products with a title that contains "Foo"
+$products = \craft\commerce\elements\Product::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+ trashed
+
+Narrows the query results to only products that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed products #}
+{% set products = craft.products()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed products
+$products = \craft\commerce\elements\Product::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+ type
+
+Narrows the query results based on the products’ types.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | of a type with a handle of `foo`.
+| `'not foo'` | not of a type with a handle of `foo`.
+| `['foo', 'bar']` | of a type with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a type with a handle of `foo` or `bar`.
+| an [ProductType](commerce3:craft\commerce\models\ProductType) object | of a type represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products with a Foo product type #}
+{% set products = craft.products()
+ .type('foo')
+ .all() %}
+```
+
+```php
+// Fetch products with a Foo product type
+$products = \craft\commerce\elements\Product::find()
+ ->type('foo')
+ ->all();
+```
+:::
+
+
+ typeId
+
+Narrows the query results based on the products’ types, per the types’ IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with an ID of 1.
+| `'not 1'` | not of a type with an ID of 1.
+| `[1, 2]` | of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a type with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch products of the product type with an ID of 1 #}
+{% set products = craft.products()
+ .typeId(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product type with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->typeId(1)
+ ->all();
+```
+:::
+
+
+ uid
+
+Narrows the query results based on the products’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the product by its UID #}
+{% set product = craft.products()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the product by its UID
+$product = \craft\commerce\elements\Product::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+ unique
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique products across all sites #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique products across all sites
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+ uri
+
+Narrows the query results based on the products’ URIs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a URI of `foo`.
+| `'foo*'` | with a URI that begins with `foo`.
+| `'*foo'` | with a URI that ends with `foo`.
+| `'*foo*'` | with a URI that contains `foo`.
+| `'not *foo*'` | with a URI that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a URI that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a URI that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested URI #}
+{% set requestedUri = craft.app.request.getPathInfo() %}
+
+{# Fetch the product with that URI #}
+{% set product = craft.products()
+ .uri(requestedUri|literal)
+ .one() %}
+```
+
+```php
+// Get the requested URI
+$requestedUri = \Craft::$app->request->getPathInfo();
+
+// Fetch the product with that URI
+$product = \craft\commerce\elements\Product::find()
+ ->uri(\craft\helpers\Db::escapeParam($requestedUri))
+ ->one();
+```
+:::
+
+
+ with
+
+Causes the query to return matching products eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch products eager-loaded with the "Related" field’s relations #}
+{% set products = craft.products()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch products eager-loaded with the "Related" field’s relations
+$products = \craft\commerce\elements\Product::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
+
+## Variants
+
+A variant describes the individual properties of a product as an item that may be purchased.
+
+Those properties inclue a SKU, price, and dimensions. Even if a product doesn’t appear to have any variants in the control panel, it still uses one *default variant* behind the scenes.
+
+Let’s compare examples of a single-variant an multi-variant product: a paperback book and a t-shirt.
+
+A book sold in only one format does not have meaningful variations for the customer to choose, but it would still have a specific SKU, price, weight, and dimensions. A single, implicit default variant needs to exist and that’s what would be added to the cart.
+
+A t-shirt, on the other hand, would have at least one variant for each available color and size combination. You wouldn’t sell the t-shirt without a specific color and size, so multiple variants would be necessary. If the shirt came in “small” and “large” sizes and “red” or “blue” colors, four unique variants could exist:
+
+- small, red
+- small, blue
+- large, red
+- large, blue
+
+### Variant Properties
+
+Each variant includes the following unique properties:
+
+| Property | Type | Required? |
+| ------------- | ------------------- | -------------- |
+| SKU | string | |
+| Price | number | |
+| Stock | number or unlimited | |
+| Allowed Qty | range | |
+| Dimensions | number (l × w × h) | |
+| Weight | number | |
+| Related Sales | relationship (Sale) | |
+
+Each variant may also have any number of custom fields to allow other distinguishing traits.
+
+Commerce does not automatically create every possible unique variant for you—that’s up to the store manager.
+
+### Default Variant
+
+Every product has a default variant. Whenever a product is created, a default variant will be created as well.
+
+If a product type has multiple variants enabled, the author can choose which one should be used by default. Products that do not have multiple variants still have a default variant, but the author can’t add additional variants.
+
+For a single-variant product, variant details are shown in a unified view with custom product fields:
+
+![Single-Variant Product](./images/single-variant.png)
+
+When a product supports multiple variants, the default variant will be identified in a **Variants** field where more variants can be added:
+
+![Multi-Variant Product](./images/multi-variant.png)
+
+### Variant Stock
+
+Variants can have unlimited stock or a specific quantity.
+
+A finite stock amount will automatically be reduced whenever someone completes an order, until the stock amount reaches zero. At that point the variant’s “Available for purchase” setting won’t be changed, but zero-stock variants cannot be added to a cart.
+
+For returns or refunds that aren’t ultimately delivered to the customer, you’ll need to either manually update product stock or use [the `orderStatusChange` event](extend/events.md#orderstatuschange) to automate further stock adjustments.
+
+## Querying Variants
+
+You can fetch variants using **variant queries**.
+
+::: code
+```twig
+{# Create a new variant query #}
+{% set myVariantQuery = craft.variants() %}
+```
+```php
+// Create a new variant query
+$myVariantQuery = \craft\commerce\elements\Variant::find();
+```
+```graphql
+# Create a new variant query
+{
+ variants {
+ # ...
+ }
+}
+```
+:::
+
+Once you’ve created a variant query, you can set [parameters](#variant-query-parameters) on it to narrow down the results, and then [execute it](https://craftcms.com/docs/3.x/element-queries.html#executing-element-queries) by calling `.all()`. An array of [Variant](commerce3:craft\commerce\elements\Variant) objects will be returned.
+
+You can also fetch only the number of items a query might return, which is better for performance when you don’t need the variant data.
+
+::: code
+```twig
+{# Count all enabled variants #}
+{% set myVariantCount = craft.variants()
+ .status('enabled')
+ .count() %}
+```
+```php
+use craft\commerce\elements\Variant;
+
+// Count all enabled variants
+$myVariantCount = Variant::find()
+ ->status(Variant::STATUS_ENABLED)
+ ->count();
+```
+```graphql
+# Count all enabled variants
+{
+ variantCount(status: "enabled")
+}
+```
+:::
+
+::: tip
+See [Element Queries](https://craftcms.com/docs/3.x/element-queries.html) in the Craft docs to learn about how element queries work.
+:::
+
+### Example
+
+We can display a specific variant by its ID in Twig by doing the following:
+
+1. Create a variant query with `craft.variants()`.
+2. Set the [`id`](#id) parameter on it.
+3. Fetch the variant with `.one()`.
+4. Output information about the variant as HTML.
+
+```twig
+{# Get the requested variant ID from the query string #}
+{% set variantId = craft.app.request.getQueryParam('id') %}
+
+{# Create a variant query with the 'id' parameter #}
+{% set myVariantQuery = craft.variants()
+ .id(variantId) %}
+
+{# Fetch the variant #}
+{% set variant = myVariantQuery.one() %}
+
+{# Make sure it exists #}
+{% if not variant %}
+ {% exit 404 %}
+{% endif %}
+
+{# Display the variant #}
+{{ variant.title }}
+
+```
+
+Fetching the equivalent with GraphQL could look like this:
+
+```graphql
+# Fetch variant having ID = 46
+{
+ variants(id: 46) {
+ title
+ }
+}
+```
+
+## Variant Query Parameters
+
+Variant queries support the following parameters:
+
+
+
+
+
+
+
+| Param | Description
+| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#variant-afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#variant-andrelatedto) | Narrows the query results to only variants that are related to certain other elements.
+| [anyStatus](#variant-anystatus) | Removes element filters based on their statuses.
+| [asArray](#variant-asarray) | Causes the query to return matching variants as arrays of data, rather than [Variant](commerce3:craft\commerce\elements\Variant) objects.
+| [cache](#variant-cache) | Enables query cache for this Query.
+| [clearCachedResult](#variant-clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+| [dateCreated](#variant-datecreated) | Narrows the query results based on the variants’ creation dates.
+| [dateUpdated](#variant-dateupdated) | Narrows the query results based on the variants’ last-updated dates.
+| [fixedOrder](#variant-fixedorder) | Causes the query results to be returned in the order specified by [id](#variant-id).
+| [hasProduct](#variant-hasproduct) | Narrows the query results to only variants for certain products.
+| [hasSales](#variant-hassales) | Narrows the query results to only variants that are on sale.
+| [hasStock](#variant-hasstock) | Narrows the query results to only variants that have stock.
+| [hasUnlimitedStock](#variant-hasunlimitedstock) | Narrows the query results to only variants that have been set to unlimited stock.
+| [height](#variant-height) | Narrows the query results based on the variants’ height dimension.
+| [id](#variant-id) | Narrows the query results based on the variants’ IDs.
+| [ignorePlaceholders](#variant-ignoreplaceholders) | Causes the query to return matching variants as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#variant-inreverse) | Causes the query results to be returned in reverse order.
+| [isDefault](#variant-isdefault) | Narrows the query results to only default variants.
+| [length](#variant-length) | Narrows the query results based on the variants’ length dimension.
+| [limit](#variant-limit) | Determines the number of variants that should be returned.
+| [maxQty](#variant-maxqty) | Narrows the query results based on the variants’ max quantity.
+| [minQty](#variant-minqty) | Narrows the query results based on the variants’ min quantity.
+| [offset](#variant-offset) | Determines how many variants should be skipped in the results.
+| [orderBy](#variant-orderby) | Determines the order that the variants should be returned in. (If empty, defaults to `sortOrder ASC`.)
+| [preferSites](#variant-prefersites) | If [unique](#variant-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [price](#variant-price) | Narrows the query results based on the variants’ price.
+| [product](#variant-product) | Narrows the query results based on the variants’ product.
+| [productId](#variant-productid) | Narrows the query results based on the variants’ products’ IDs.
+| [relatedTo](#variant-relatedto) | Narrows the query results to only variants that are related to certain other elements.
+| [search](#variant-search) | Narrows the query results to only variants that match a search query.
+| [site](#variant-site) | Determines which site(s) the variants should be queried in.
+| [siteId](#variant-siteid) | Determines which site(s) the variants should be queried in, per the site’s ID.
+| [siteSettingsId](#variant-sitesettingsid) | Narrows the query results based on the variants’ IDs in the `elements_sites` table.
+| [sku](#variant-sku) | Narrows the query results based on the variants’ SKUs.
+| [status](#variant-status) | Narrows the query results based on the variants’ statuses.
+| [stock](#variant-stock) | Narrows the query results based on the variants’ stock.
+| [title](#variant-title) | Narrows the query results based on the variants’ titles.
+| [trashed](#variant-trashed) | Narrows the query results to only variants that have been soft-deleted.
+| [typeId](#variant-typeid) | Narrows the query results based on the variants’ product types, per their IDs.
+| [uid](#variant-uid) | Narrows the query results based on the variants’ UIDs.
+| [unique](#variant-unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [weight](#variant-weight) | Narrows the query results based on the variants’ weight dimension.
+| [width](#variant-width) | Narrows the query results based on the variants’ width dimension.
+| [with](#variant-with) | Causes the query to return matching variants eager-loaded with related elements.
+
+
+
+
+
+ afterPopulate
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+
+
+Narrows the query results to only variants that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all variants that are related to myCategoryA and myCategoryB #}
+{% set variants = craft.variants()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all variants that are related to $myCategoryA and $myCategoryB
+$variants = \craft\commerce\elements\Variant::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+ anyStatus
+
+Removes element filters based on their statuses.
+
+
+
+
+
+::: code
+```twig
+{# Fetch all variants, regardless of status #}
+{% set variants = craft.variants()
+ .anyStatus()
+ .all() %}
+```
+
+```php
+// Fetch all variants, regardless of status
+$variants = \craft\commerce\elements\Variant::find()
+ ->anyStatus()
+ ->all();
+```
+:::
+
+
+ asArray
+
+Causes the query to return matching variants as arrays of data, rather than [Variant](commerce3:craft\commerce\elements\Variant) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants as arrays #}
+{% set variants = craft.variants()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch variants as arrays
+$variants = \craft\commerce\elements\Variant::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+ cache
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+ clearCachedResult
+
+Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+
+
+
+
+
+
+ dateCreated
+
+Narrows the query results based on the variants’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch variants created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set variants = craft.variants()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch variants created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ dateUpdated
+
+Narrows the query results based on the variants’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch variants updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set variants = craft.variants()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch variants updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+ fixedOrder
+
+Causes the query results to be returned in the order specified by [id](#variant-id).
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants in a specific order #}
+{% set variants = craft.variants()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch variants in a specific order
+$variants = \craft\commerce\elements\Variant::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+ hasProduct
+
+Narrows the query results to only variants for certain products.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [ProductQuery](commerce3:craft\commerce\elements\db\ProductQuery) object | for products that match the query.
+
+
+
+
+ hasSales
+
+Narrows the query results to only variants that are on sale.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | on sale
+| `false` | not on sale
+
+
+
+
+ hasStock
+
+Narrows the query results to only variants that have stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | with stock.
+| `false` | with no stock.
+
+
+
+
+ hasUnlimitedStock
+
+Narrows the query results to only variants that have been set to unlimited stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | with unlimited stock checked.
+| `false` | with unlimited stock not checked.
+
+
+
+
+ height
+
+Narrows the query results based on the variants’ height dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a height of 100.
+| `'>= 100'` | with a height of at least 100.
+| `'< 100'` | with a height of less than 100.
+
+
+
+
+ id
+
+Narrows the query results based on the variants’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the variant by its ID #}
+{% set variant = craft.variants()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the variant by its ID
+$variant = \craft\commerce\elements\Variant::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#variant-fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+ ignorePlaceholders
+
+Causes the query to return matching variants as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+ inReverse
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants in reverse #}
+{% set variants = craft.variants()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch variants in reverse
+$variants = \craft\commerce\elements\Variant::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+ isDefault
+
+Narrows the query results to only default variants.
+
+
+
+::: code
+```twig
+{# Fetch default variants #}
+{% set variants = craft.variants()
+ .isDefault()
+ .all() %}
+```
+
+```php
+// Fetch default variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->isDefault()
+ ->all();
+```
+:::
+
+
+ length
+
+Narrows the query results based on the variants’ length dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a length of 100.
+| `'>= 100'` | with a length of at least 100.
+| `'< 100'` | with a length of less than 100.
+
+
+
+
+ limit
+
+Determines the number of variants that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 variants #}
+{% set variants = craft.variants()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+ maxQty
+
+Narrows the query results based on the variants’ max quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a maxQty of 100.
+| `'>= 100'` | with a maxQty of at least 100.
+| `'< 100'` | with a maxQty of less than 100.
+
+
+
+
+ minQty
+
+Narrows the query results based on the variants’ min quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a minQty of 100.
+| `'>= 100'` | with a minQty of at least 100.
+| `'< 100'` | with a minQty of less than 100.
+
+
+
+
+ offset
+
+Determines how many variants should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all variants except for the first 3 #}
+{% set variants = craft.variants()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all variants except for the first 3
+$variants = \craft\commerce\elements\Variant::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+ orderBy
+
+Determines the order that the variants should be returned in. (If empty, defaults to `sortOrder ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all variants in order of date created #}
+{% set variants = craft.variants()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all variants in order of date created
+$variants = \craft\commerce\elements\Variant::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+ preferSites
+
+If [unique](#variant-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site C, and Bar will be returned
+for Site B.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique variants from Site A, or Site B if they don’t exist in Site A #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique variants from Site A, or Site B if they don’t exist in Site A
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+ price
+
+Narrows the query results based on the variants’ price.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a price of 100.
+| `'>= 100'` | with a price of at least 100.
+| `'< 100'` | with a price of less than 100.
+
+
+
+
+ product
+
+Narrows the query results based on the variants’ product.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [Product](commerce3:craft\commerce\elements\Product) object | for a product represented by the object.
+
+
+
+
+ productId
+
+Narrows the query results based on the variants’ products’ IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product with an ID of 1.
+| `[1, 2]` | for product with an ID of 1 or 2.
+| `['not', 1, 2]` | for product not with an ID of 1 or 2.
+
+
+
+
+
+
+Narrows the query results to only variants that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all variants that are related to myCategory #}
+{% set variants = craft.variants()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all variants that are related to $myCategory
+$variants = \craft\commerce\elements\Variant::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+ search
+
+Narrows the query results to only variants that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all variants that match the search query #}
+{% set variants = craft.variants()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all variants that match the search query
+$variants = \craft\commerce\elements\Variant::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+ site
+
+Determines which site(s) the variants should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](https://docs.craftcms.com/api/v3/craft-models-site.html) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#variant-unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch variants from the Foo site #}
+{% set variants = craft.variants()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch variants from the Foo site
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+ siteId
+
+Determines which site(s) the variants should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch variants from the site with an ID of 1 #}
+{% set variants = craft.variants()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch variants from the site with an ID of 1
+$variants = \craft\commerce\elements\Variant::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+ siteSettingsId
+
+Narrows the query results based on the variants’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the variant by its ID in the elements_sites table #}
+{% set variant = craft.variants()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the variant by its ID in the elements_sites table
+$variant = \craft\commerce\elements\Variant::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+ sku
+
+Narrows the query results based on the variants’ SKUs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | with a SKU of `foo`.
+| `'foo*'` | with a SKU that begins with `foo`.
+| `'*foo'` | with a SKU that ends with `foo`.
+| `'*foo*'` | with a SKU that contains `foo`.
+| `'not *foo*'` | with a SKU that doesn’t contain `foo`.
+| `['*foo*', '*bar*'` | with a SKU that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a SKU that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested variant SKU from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the variant with that slug #}
+{% set variant = craft.variants()
+ .sku(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested variant SKU from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the variant with that slug
+$variant = \craft\commerce\elements\Variant::find()
+ ->sku(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+ status
+
+Narrows the query results based on the variants’ statuses.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'enabled'` _(default)_ | that are enabled.
+| `'disabled'` | that are disabled.
+| `['not', 'disabled']` | that are not disabled.
+
+
+
+::: code
+```twig
+{# Fetch disabled variants #}
+{% set variants = craft.variants()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+ stock
+
+Narrows the query results based on the variants’ stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `0` | with no stock.
+| `'>= 5'` | with a stock of at least 5.
+| `'< 10'` | with a stock of less than 10.
+
+
+
+
+ title
+
+Narrows the query results based on the variants’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch variants with a title that contains "Foo" #}
+{% set variants = craft.variants()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch variants with a title that contains "Foo"
+$variants = \craft\commerce\elements\Variant::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+ trashed
+
+Narrows the query results to only variants that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed variants #}
+{% set variants = craft.variants()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+ typeId
+
+Narrows the query results based on the variants’ product types, per their IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product of a type with an ID of 1.
+| `[1, 2]` | for product of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | for product of a type not with an ID of 1 or 2.
+
+
+
+
+ uid
+
+Narrows the query results based on the variants’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the variant by its UID #}
+{% set variant = craft.variants()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the variant by its UID
+$variant = \craft\commerce\elements\Variant::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+ unique
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique variants across all sites #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique variants across all sites
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+ weight
+
+Narrows the query results based on the variants’ weight dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a weight of 100.
+| `'>= 100'` | with a weight of at least 100.
+| `'< 100'` | with a weight of less than 100.
+
+
+
+
+ width
+
+Narrows the query results based on the variants’ width dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a width of 100.
+| `'>= 100'` | with a width of at least 100.
+| `'< 100'` | with a width of less than 100.
+
+
+
+
+ with
+
+Causes the query to return matching variants eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch variants eager-loaded with the "Related" field’s relations #}
+{% set variants = craft.variants()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch variants eager-loaded with the "Related" field’s relations
+$variants = \craft\commerce\elements\Variant::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/commerce/3.x/dev/element-queries/subscription-queries.md b/docs/.artifacts/commerce/3.x/subscriptions.md
similarity index 83%
rename from docs/commerce/3.x/dev/element-queries/subscription-queries.md
rename to docs/.artifacts/commerce/3.x/subscriptions.md
index f47e99982..96635f6ac 100644
--- a/docs/commerce/3.x/dev/element-queries/subscription-queries.md
+++ b/docs/.artifacts/commerce/3.x/subscriptions.md
@@ -1,65 +1,19 @@
-# Subscription Queries
+
-You can fetch subscriptions in your templates or PHP code using **subscription queries**.
-
-::: code
-```twig
-{# Create a new subscription query #}
-{% set mySubscriptionQuery = craft.subscriptions() %}
-```
-```php
-// Create a new subscription query
-$mySubscriptionQuery = \craft\commerce\elements\Subscription::find();
-```
-:::
-
-Once you’ve created a subscription query, you can set [parameters](#parameters) on it to narrow down the results, and then [execute it](https://craftcms.com/docs/3.x/element-queries.html#executing-element-queries) by calling `.all()`. An array of [Subscription](commerce3:craft\commerce\elements\Subscription) objects will be returned.
-
-::: tip
-See [Element Queries](https://craftcms.com/docs/3.x/element-queries.html) in the Craft docs to learn about how element queries work.
-:::
-
-## Example
-
-We can display all of the current user’s subscriptions by doing the following:
-
-1. Create a subscription query with `craft.subscriptions()`.
-2. Set the [user](#user) parameter on it.
-3. Fetch the subscriptions with `.all()`.
-4. Loop through the subscriptions using a [for](https://twig.symfony.com/doc/2.x/tags/for.html) tag to output their HTML.
-
-```twig
-{# Make sure someone is logged in #}
-{% requireLogin %}
-
-{# Create a subscription query with the 'user' parameter #}
-{% set mySubscriptionQuery = craft.subscriptions()
- .user(currentUser) %}
-
-{# Fetch the subscriptions #}
-{% set subscriptions = mySubscriptionQuery.all() %}
-
-{# Display the subscriptions #}
-{% for subscription in subscriptions %}
-
-
- {{ subscription.summary }}
- Learn more
-
-{% endfor %}
-```
+
-## Parameters
-Subscription queries support the following parameters:
-
+
| Param | Description
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-| [anyStatus](#anystatus) | Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only subscriptions that are related to certain other elements.
+| [anyStatus](#anystatus) | Removes element filters based on their statuses.
| [asArray](#asarray) | Causes the query to return matching subscriptions as arrays of data, rather than [Subscription](commerce3:craft\commerce\elements\Subscription) objects.
-| [clearCachedResult](#clearcachedresult) | Clears the cached result.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
| [dateCanceled](#datecanceled) | Narrows the query results based on the subscriptions’ cancellation date.
| [dateCreated](#datecreated) | Narrows the query results based on the subscriptions’ creation dates.
| [dateExpired](#dateexpired) | Narrows the query results based on the subscriptions’ expiration date.
@@ -86,6 +40,7 @@ Subscription queries support the following parameters:
| [reference](#reference) | Narrows the query results based on the reference.
| [relatedTo](#relatedto) | Narrows the query results to only subscriptions that are related to certain other elements.
| [search](#search) | Narrows the query results to only subscriptions that match a search query.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the subscriptions’ IDs in the `elements_sites` table.
| [status](#status) | Narrows the query results based on the subscriptions’ statuses.
| [trashed](#trashed) | Narrows the query results to only subscriptions that have been soft-deleted.
| [trialDays](#trialdays) | Narrows the query results based on the number of trial days.
@@ -94,9 +49,55 @@ Subscription queries support the following parameters:
| [userId](#userid) | Narrows the query results based on the subscriptions’ user accounts’ IDs.
| [with](#with) | Causes the query to return matching subscriptions eager-loaded with related elements.
-### `anyStatus`
-Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-enabledforsite) parameters.
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only subscriptions that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions that are related to myCategoryA and myCategoryB #}
+{% set subscriptions = craft.subscriptions()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions that are related to $myCategoryA and $myCategoryB
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `anyStatus`
+
+Removes element filters based on their statuses.
@@ -106,8 +107,8 @@ Clears out the [status](#status) and [enabledForSite()](https://docs.craftcms.co
```twig
{# Fetch all subscriptions, regardless of status #}
{% set subscriptions = craft.subscriptions()
- .anyStatus()
- .all() %}
+ .anyStatus()
+ .all() %}
```
```php
@@ -119,7 +120,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `asArray`
+#### `asArray`
Causes the query to return matching subscriptions as arrays of data, rather than [Subscription](commerce3:craft\commerce\elements\Subscription) objects.
@@ -131,8 +132,8 @@ Causes the query to return matching subscriptions as arrays of data, rather than
```twig
{# Fetch subscriptions as arrays #}
{% set subscriptions = craft.subscriptions()
- .asArray()
- .all() %}
+ .asArray()
+ .all() %}
```
```php
@@ -144,16 +145,29 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `clearCachedResult`
+#### `cache`
+
+Enables query cache for this Query.
-Clears the cached result.
-### `dateCanceled`
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/3.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `dateCanceled`
Narrows the query results based on the subscriptions’ cancellation date.
@@ -173,8 +187,8 @@ Possible values include:
{% set aWeekAgo = date('7 days ago')|atom %}
{% set subscriptions = craft.subscriptions()
- .dateCanceled(">= #{aWeekAgo}")
- .all() %}
+ .dateCanceled(">= #{aWeekAgo}")
+ .all() %}
```
```php
@@ -188,7 +202,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `dateCreated`
+#### `dateCreated`
Narrows the query results based on the subscriptions’ creation dates.
@@ -211,8 +225,8 @@ Possible values include:
{% set end = date('first day of this month')|atom %}
{% set subscriptions = craft.subscriptions()
- .dateCreated(['and', ">= #{start}", "< #{end}"])
- .all() %}
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
```
```php
@@ -227,7 +241,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `dateExpired`
+#### `dateExpired`
Narrows the query results based on the subscriptions’ expiration date.
@@ -247,8 +261,8 @@ Possible values include:
{% set aWeekAgo = date('7 days ago')|atom %}
{% set subscriptions = craft.subscriptions()
- .dateExpired(">= #{aWeekAgo}")
- .all() %}
+ .dateExpired(">= #{aWeekAgo}")
+ .all() %}
```
```php
@@ -262,7 +276,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `dateSuspended`
+#### `dateSuspended`
Narrows the query results based on the subscriptions’ suspension date.
@@ -281,8 +295,8 @@ Possible values include:
{% set aWeekAgo = date('7 days ago')|atom %}
{% set subscriptions = craft.subscriptions()
- .dateSuspended(">= #{aWeekAgo}")
- .all() %}
+ .dateSuspended(">= #{aWeekAgo}")
+ .all() %}
```
```php
@@ -296,7 +310,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `dateUpdated`
+#### `dateUpdated`
Narrows the query results based on the subscriptions’ last-updated dates.
@@ -318,8 +332,8 @@ Possible values include:
{% set lastWeek = date('1 week ago')|atom %}
{% set subscriptions = craft.subscriptions()
- .dateUpdated(">= #{lastWeek}")
- .all() %}
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
```
```php
@@ -333,7 +347,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `fixedOrder`
+#### `fixedOrder`
Causes the query results to be returned in the order specified by [id](#id).
@@ -345,9 +359,9 @@ Causes the query results to be returned in the order specified by [id](#id).
```twig
{# Fetch subscriptions in a specific order #}
{% set subscriptions = craft.subscriptions()
- .id([1, 2, 3, 4, 5])
- .fixedOrder()
- .all() %}
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
```
```php
@@ -360,7 +374,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `gatewayId`
+#### `gatewayId`
Narrows the query results based on the gateway, per its ID.
@@ -376,7 +390,7 @@ Possible values include:
-### `hasStarted`
+#### `hasStarted`
Narrows the query results to only subscriptions that have started.
@@ -386,8 +400,8 @@ Narrows the query results to only subscriptions that have started.
```twig
{# Fetch started subscriptions #}
{% set subscriptions = craft.subscriptions()
- .hasStarted()
- .all() %}
+ .hasStarted()
+ .all() %}
```
```php
@@ -399,7 +413,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `id`
+#### `id`
Narrows the query results based on the subscriptions’ IDs.
@@ -420,8 +434,8 @@ Possible values include:
```twig
{# Fetch the subscription by its ID #}
{% set subscription = craft.subscriptions()
- .id(1)
- .one() %}
+ .id(1)
+ .one() %}
```
```php
@@ -439,7 +453,7 @@ This can be combined with [fixedOrder](#fixedorder) if you want the results to b
:::
-### `ignorePlaceholders`
+#### `ignorePlaceholders`
Causes the query to return matching subscriptions as they are stored in the database, ignoring matching placeholder
elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v3/craft-services-elements.html#method-setplaceholderelement).
@@ -453,7 +467,7 @@ elements that were set by [craft\services\Elements::setPlaceholderElement()](htt
-### `inReverse`
+#### `inReverse`
Causes the query results to be returned in reverse order.
@@ -465,8 +479,8 @@ Causes the query results to be returned in reverse order.
```twig
{# Fetch subscriptions in reverse #}
{% set subscriptions = craft.subscriptions()
- .inReverse()
- .all() %}
+ .inReverse()
+ .all() %}
```
```php
@@ -478,7 +492,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `isCanceled`
+#### `isCanceled`
Narrows the query results to only subscriptions that are canceled.
@@ -488,8 +502,8 @@ Narrows the query results to only subscriptions that are canceled.
```twig
{# Fetch canceled subscriptions #}
{% set subscriptions = craft.subscriptions()
- .isCanceled()
- .all() %}
+ .isCanceled()
+ .all() %}
```
```php
@@ -501,7 +515,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `isExpired`
+#### `isExpired`
Narrows the query results to only subscriptions that have expired.
@@ -511,8 +525,8 @@ Narrows the query results to only subscriptions that have expired.
```twig
{# Fetch expired subscriptions #}
{% set subscriptions = craft.subscriptions()
- .isExpired()
- .all() %}
+ .isExpired()
+ .all() %}
```
```php
@@ -524,7 +538,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `isSuspended`
+#### `isSuspended`
Narrows the query results to only subscriptions that are suspended.
@@ -534,8 +548,8 @@ Narrows the query results to only subscriptions that are suspended.
```twig
{# Fetch suspended subscriptions #}
{% set subscriptions = craft.subscriptions()
- .isSuspended()
- .all() %}
+ .isSuspended()
+ .all() %}
```
```php
@@ -547,7 +561,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `limit`
+#### `limit`
Determines the number of subscriptions that should be returned.
@@ -557,8 +571,8 @@ Determines the number of subscriptions that should be returned.
```twig
{# Fetch up to 10 subscriptions #}
{% set subscriptions = craft.subscriptions()
- .limit(10)
- .all() %}
+ .limit(10)
+ .all() %}
```
```php
@@ -570,7 +584,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `nextPaymentDate`
+#### `nextPaymentDate`
Narrows the query results based on the subscriptions’ next payment dates.
@@ -590,8 +604,8 @@ Possible values include:
{% set aWeekFromNow = date('+7 days')|atom %}
{% set subscriptions = craft.subscriptions()
- .nextPaymentDate("< #{aWeekFromNow}")
- .all() %}
+ .nextPaymentDate("< #{aWeekFromNow}")
+ .all() %}
```
```php
@@ -605,7 +619,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `offset`
+#### `offset`
Determines how many subscriptions should be skipped in the results.
@@ -615,8 +629,8 @@ Determines how many subscriptions should be skipped in the results.
```twig
{# Fetch all subscriptions except for the first 3 #}
{% set subscriptions = craft.subscriptions()
- .offset(3)
- .all() %}
+ .offset(3)
+ .all() %}
```
```php
@@ -628,7 +642,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `onTrial`
+#### `onTrial`
Narrows the query results to only subscriptions that are on trial.
@@ -638,8 +652,8 @@ Narrows the query results to only subscriptions that are on trial.
```twig
{# Fetch trialed subscriptions #}
{% set subscriptions = craft.subscriptions()
- .onTrial()
- .all() %}
+ .onTrial()
+ .all() %}
```
```php
@@ -651,7 +665,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `orderBy`
+#### `orderBy`
Determines the order that the subscriptions should be returned in. (If empty, defaults to `dateCreated DESC`.)
@@ -661,8 +675,8 @@ Determines the order that the subscriptions should be returned in. (If empty, de
```twig
{# Fetch all subscriptions in order of date created #}
{% set subscriptions = craft.subscriptions()
- .orderBy('dateCreated ASC')
- .all() %}
+ .orderBy('dateCreated ASC')
+ .all() %}
```
```php
@@ -674,7 +688,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `orderId`
+#### `orderId`
Narrows the query results based on the order, per its ID.
@@ -690,7 +704,7 @@ Possible values include:
-### `plan`
+#### `plan`
Narrows the query results based on the subscription plan.
@@ -708,8 +722,8 @@ Possible values include:
```twig
{# Fetch Supporter plan subscriptions #}
{% set subscriptions = craft.subscriptions()
- .plan('supporter')
- .all() %}
+ .plan('supporter')
+ .all() %}
```
```php
@@ -721,7 +735,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `planId`
+#### `planId`
Narrows the query results based on the subscription plans’ IDs.
@@ -736,7 +750,7 @@ Possible values include:
-### `preferSites`
+#### `preferSites`
If [unique()](https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
@@ -754,10 +768,10 @@ If this isn’t set, then preference goes to the current site.
```twig
{# Fetch unique subscriptions from Site A, or Site B if they don’t exist in Site A #}
{% set subscriptions = craft.subscriptions()
- .site('*')
- .unique()
- .preferSites(['a', 'b'])
- .all() %}
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
```
```php
@@ -771,7 +785,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `reference`
+#### `reference`
Narrows the query results based on the reference.
@@ -780,7 +794,7 @@ Narrows the query results based on the reference.
-### `relatedTo`
+#### `relatedTo`
Narrows the query results to only subscriptions that are related to certain other elements.
@@ -794,8 +808,8 @@ See [Relations](https://craftcms.com/docs/3.x/relations.html) for a full explana
```twig
{# Fetch all subscriptions that are related to myCategory #}
{% set subscriptions = craft.subscriptions()
- .relatedTo(myCategory)
- .all() %}
+ .relatedTo(myCategory)
+ .all() %}
```
```php
@@ -807,7 +821,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `search`
+#### `search`
Narrows the query results to only subscriptions that match a search query.
@@ -824,8 +838,8 @@ See [Searching](https://craftcms.com/docs/3.x/searching.html) for a full explana
{# Fetch all subscriptions that match the search query #}
{% set subscriptions = craft.subscriptions()
- .search(searchQuery)
- .all() %}
+ .search(searchQuery)
+ .all() %}
```
```php
@@ -840,7 +854,41 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `status`
+#### `siteSettingsId`
+
+Narrows the query results based on the subscriptions’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its ID in the elements_sites table #}
+{% set subscription = craft.subscriptions()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its ID in the elements_sites table
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `status`
Narrows the query results based on the subscriptions’ statuses.
@@ -857,8 +905,8 @@ Possible values include:
```twig
{# Fetch expired subscriptions #}
{% set subscriptions = craft.subscriptions()
- .status('expired')
- .all() %}
+ .status('expired')
+ .all() %}
```
```php
@@ -870,7 +918,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `trashed`
+#### `trashed`
Narrows the query results to only subscriptions that have been soft-deleted.
@@ -882,8 +930,8 @@ Narrows the query results to only subscriptions that have been soft-deleted.
```twig
{# Fetch trashed subscriptions #}
{% set subscriptions = craft.subscriptions()
- .trashed()
- .all() %}
+ .trashed()
+ .all() %}
```
```php
@@ -895,7 +943,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `trialDays`
+#### `trialDays`
Narrows the query results based on the number of trial days.
@@ -904,7 +952,7 @@ Narrows the query results based on the number of trial days.
-### `uid`
+#### `uid`
Narrows the query results based on the subscriptions’ UIDs.
@@ -916,8 +964,8 @@ Narrows the query results based on the subscriptions’ UIDs.
```twig
{# Fetch the subscription by its UID #}
{% set subscription = craft.subscriptions()
- .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
- .one() %}
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
```
```php
@@ -929,7 +977,7 @@ $subscription = \craft\commerce\elements\Subscription::find()
:::
-### `user`
+#### `user`
Narrows the query results based on the subscriptions’ user accounts.
@@ -947,8 +995,8 @@ Possible values include:
```twig
{# Fetch the current user's subscriptions #}
{% set subscriptions = craft.subscriptions()
- .user(currentUser)
- .all() %}
+ .user(currentUser)
+ .all() %}
```
```php
@@ -961,7 +1009,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `userId`
+#### `userId`
Narrows the query results based on the subscriptions’ user accounts’ IDs.
@@ -979,8 +1027,8 @@ Possible values include:
```twig
{# Fetch the current user's subscriptions #}
{% set subscriptions = craft.subscriptions()
- .userId(currentUser.id)
- .all() %}
+ .userId(currentUser.id)
+ .all() %}
```
```php
@@ -993,7 +1041,7 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
:::
-### `with`
+#### `with`
Causes the query to return matching subscriptions eager-loaded with related elements.
@@ -1007,8 +1055,8 @@ See [Eager-Loading Elements](https://craftcms.com/docs/3.x/dev/eager-loading-ele
```twig
{# Fetch subscriptions eager-loaded with the "Related" field’s relations #}
{% set subscriptions = craft.subscriptions()
- .with(['related'])
- .all() %}
+ .with(['related'])
+ .all() %}
```
```php
diff --git a/docs/.artifacts/commerce/4.x/config.md b/docs/.artifacts/commerce/4.x/config.md
new file mode 100644
index 000000000..3f8318290
--- /dev/null
+++ b/docs/.artifacts/commerce/4.x/config.md
@@ -0,0 +1,810 @@
+
+
+
+
+## System
+
+### `defaultView`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'commerce/orders'`
+
+Defined by
+: [Settings::$defaultView](commerce4:craft\commerce\models\Settings::$defaultView)
+
+Since
+: 2.2
+
+
+
+Commerce’s default control panel view. (Defaults to order index.)
+
+
+
+### `emailSenderAddress`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderAddress](commerce4:craft\commerce\models\Settings::$emailSenderAddress)
+
+
+
+Default email address Commerce system messages should be sent from.
+
+If `null` (default), Craft’s [MailSettings::$fromEmail](craft4:craft\models\MailSettings::$fromEmail) will be used.
+
+
+
+### `emailSenderAddressPlaceholder`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderAddressPlaceholder](commerce4:craft\commerce\models\Settings::$emailSenderAddressPlaceholder)
+
+
+
+Placeholder value displayed for the sender address control panel settings field.
+
+If `null` (default), Craft’s [MailSettings::$fromEmail](craft4:craft\models\MailSettings::$fromEmail) will be used.
+
+
+
+### `emailSenderName`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderName](commerce4:craft\commerce\models\Settings::$emailSenderName)
+
+
+
+Default from name used for Commerce system emails.
+
+If `null` (default), Craft’s [MailSettings::$fromName](craft4:craft\models\MailSettings::$fromName) will be used.
+
+
+
+### `emailSenderNamePlaceholder`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$emailSenderNamePlaceholder](commerce4:craft\commerce\models\Settings::$emailSenderNamePlaceholder)
+
+
+
+Placeholder value displayed for the sender name control panel settings field.
+
+If `null` (default), Craft’s [MailSettings::$fromName](craft4:craft\models\MailSettings::$fromName) will be used.
+
+
+
+### `showEditUserCommerceTab`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$showEditUserCommerceTab](commerce4:craft\commerce\models\Settings::$showEditUserCommerceTab)
+
+Since
+: 4.0
+
+
+
+Whether the [Commerce Tab](customers.md#user-customer-info-tab) should be shown when viewing users in the control panel.
+
+
+
+## Cart
+
+### `activeCartDuration`
+
+
+
+Allowed types
+: `mixed`
+
+Default value
+: `3600` (1 hour)
+
+Defined by
+: [Settings::$activeCartDuration](commerce4:craft\commerce\models\Settings::$activeCartDuration)
+
+Since
+: 2.2
+
+
+
+How long a cart should go without being updated before it’s considered inactive.
+
+See [craft\helpers\ConfigHelper::durationInSeconds()](craft4:craft\helpers\ConfigHelper::durationInSeconds()) for a list of supported value types.
+
+
+
+### `allowCheckoutWithoutPayment`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowCheckoutWithoutPayment](commerce4:craft\commerce\models\Settings::$allowCheckoutWithoutPayment)
+
+Since
+: 3.3
+
+
+
+Whether carts are can be marked as completed without a payment.
+
+
+
+### `allowEmptyCartOnCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowEmptyCartOnCheckout](commerce4:craft\commerce\models\Settings::$allowEmptyCartOnCheckout)
+
+Since
+: 2.2
+
+
+
+Whether carts are allowed to be empty on checkout.
+
+
+
+### `autoSetCartShippingMethodOption`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$autoSetCartShippingMethodOption](commerce4:craft\commerce\models\Settings::$autoSetCartShippingMethodOption)
+
+
+
+Whether the first available shipping method option should be set automatically on carts.
+
+
+
+### `autoSetNewCartAddresses`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$autoSetNewCartAddresses](commerce4:craft\commerce\models\Settings::$autoSetNewCartAddresses)
+
+
+
+Whether the user’s primary shipping and billing addresses should be set automatically on new carts.
+
+
+
+### `autoSetPaymentSource`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$autoSetPaymentSource](commerce4:craft\commerce\models\Settings::$autoSetPaymentSource)
+
+Since
+: 4.2
+
+
+
+Whether the user’s primary payment source should be set automatically on new carts.
+
+
+
+### `cartVariable`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'cart'`
+
+Defined by
+: [Settings::$cartVariable](commerce4:craft\commerce\models\Settings::$cartVariable)
+
+
+
+Key to be used when returning cart information in a response.
+
+
+
+### `loadCartRedirectUrl`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$loadCartRedirectUrl](commerce4:craft\commerce\models\Settings::$loadCartRedirectUrl)
+
+Since
+: 3.1
+
+
+
+Default URL to be loaded after using the [load cart controller action](orders-carts.md#loading-a-cart).
+
+If `null` (default), Craft’s default [`siteUrl`](config4:siteUrl) will be used.
+
+
+
+### `purgeInactiveCarts`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$purgeInactiveCarts](commerce4:craft\commerce\models\Settings::$purgeInactiveCarts)
+
+
+
+Whether inactive carts should automatically be deleted from the database during garbage collection.
+
+::: tip
+You can control how long a cart should go without being updated before it gets deleted [`purgeInactiveCartsDuration`](#purgeinactivecartsduration) setting.
+:::
+
+
+
+### `purgeInactiveCartsDuration`
+
+
+
+Allowed types
+: `mixed`
+
+Default value
+: `7776000` (90 days)
+
+Defined by
+: [Settings::$purgeInactiveCartsDuration](commerce4:craft\commerce\models\Settings::$purgeInactiveCartsDuration)
+
+
+
+Default length of time before inactive carts are purged. (Defaults to 90 days.)
+
+See [craft\helpers\ConfigHelper::durationInSeconds()](craft4:craft\helpers\ConfigHelper::durationInSeconds()) for a list of supported value types.
+
+
+
+### `updateCartSearchIndexes`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `true`
+
+Defined by
+: [Settings::$updateCartSearchIndexes](commerce4:craft\commerce\models\Settings::$updateCartSearchIndexes)
+
+Since
+: 3.1.5
+
+
+
+Whether the search index for a cart should be updated when saving the cart via `commerce/cart/*` controller actions.
+
+May be set to `false` to reduce performance impact on high-traffic sites.
+
+::: warning
+Setting this to `false` will result in fewer index update queue jobs, but you’ll need to manually re-index orders to ensure up-to-date cart search results in the control panel.
+:::
+
+
+
+### `validateCartCustomFieldsOnSubmission`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$validateCartCustomFieldsOnSubmission](commerce4:craft\commerce\models\Settings::$validateCartCustomFieldsOnSubmission)
+
+Since
+: 3.0.12
+
+
+
+Whether to validate custom fields when a cart is updated.
+
+Set to `true` to allow custom content fields to return validation errors when a cart is updated.
+
+
+
+## Orders
+
+### `freeOrderPaymentStrategy`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'complete'`
+
+Defined by
+: [Settings::$freeOrderPaymentStrategy](commerce4:craft\commerce\models\Settings::$freeOrderPaymentStrategy)
+
+
+
+How Commerce should handle free orders.
+
+The default `'complete'` setting automatically completes zero-balance orders without forwarding them to the payment gateway.
+
+The `'process'` setting forwards zero-balance orders to the payment gateway for processing. This can be useful if the customer’s balance
+needs to be updated or otherwise adjusted by the payment gateway.
+
+
+
+### `minimumTotalPriceStrategy`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'default'`
+
+Defined by
+: [Settings::$minimumTotalPriceStrategy](commerce4:craft\commerce\models\Settings::$minimumTotalPriceStrategy)
+
+
+
+How Commerce should handle minimum total price for an order.
+
+Options:
+
+- `'default'` [rounds](commerce4:\craft\commerce\helpers\Currency::round()) the sum of the item subtotal and adjustments.
+- `'zero'` returns `0` if the result from `'default'` would’ve been negative; minimum order total is `0`.
+- `'shipping'` returns the total shipping cost if the `'default'` result would’ve been negative; minimum order total equals shipping amount.
+
+
+
+### `orderReferenceFormat`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'{{number[:7]}}'`
+
+Defined by
+: [Settings::$orderReferenceFormat](commerce4:craft\commerce\models\Settings::$orderReferenceFormat)
+
+
+
+Human-friendly reference number format for orders. Result must be unique.
+
+See [Order Numbers](orders-carts.md#order-numbers).
+
+
+
+### `pdfAllowRemoteImages`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$pdfAllowRemoteImages](commerce4:craft\commerce\models\Settings::$pdfAllowRemoteImages)
+
+
+
+Whether to allow non-local images in generated order PDFs.
+
+
+
+### `pdfPaperOrientation`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'portrait'`
+
+Defined by
+: [Settings::$pdfPaperOrientation](commerce4:craft\commerce\models\Settings::$pdfPaperOrientation)
+
+
+
+The orientation of the paper to use for generated order PDF files.
+
+Options are `'portrait'` and `'landscape'`.
+
+
+
+### `pdfPaperSize`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'letter'`
+
+Defined by
+: [Settings::$pdfPaperSize](commerce4:craft\commerce\models\Settings::$pdfPaperSize)
+
+
+
+The size of the paper to use for generated order PDFs.
+
+The full list of supported paper sizes can be found [in the dompdf library](https://github.com/dompdf/dompdf/blob/master/src/Adapter/CPDF.php#L45).
+
+
+
+### `requireBillingAddressAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireBillingAddressAtCheckout](commerce4:craft\commerce\models\Settings::$requireBillingAddressAtCheckout)
+
+
+
+Whether a billing address is required before making payment on an order.
+
+
+
+### `requireShippingAddressAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireShippingAddressAtCheckout](commerce4:craft\commerce\models\Settings::$requireShippingAddressAtCheckout)
+
+
+
+Whether a shipping address is required before making payment on an order.
+
+
+
+### `requireShippingMethodSelectionAtCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$requireShippingMethodSelectionAtCheckout](commerce4:craft\commerce\models\Settings::$requireShippingMethodSelectionAtCheckout)
+
+
+
+Whether shipping method selection is required before making payment on an order.
+
+
+
+### `updateBillingDetailsUrl`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `''`
+
+Defined by
+: [Settings::$updateBillingDetailsUrl](commerce4:craft\commerce\models\Settings::$updateBillingDetailsUrl)
+
+
+
+URL for a user to resolve billing issues with their subscription.
+
+::: tip
+The example templates include [a template for this page](https://github.com/craftcms/commerce/tree/main/example-templates/dist/shop/plans/update-billing-details.twig).
+:::
+
+
+
+### `useBillingAddressForTax`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$useBillingAddressForTax](commerce4:craft\commerce\models\Settings::$useBillingAddressForTax)
+
+
+
+Whether taxes should be calculated based on the billing address instead of the shipping address.
+
+
+
+### `validateBusinessTaxIdAsVatId`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$validateBusinessTaxIdAsVatId](commerce4:craft\commerce\models\Settings::$validateBusinessTaxIdAsVatId)
+
+
+
+Whether to enable validation requiring the `businessTaxId` to be a valid VAT ID.
+
+When set to `false`, no validation is applied to `businessTaxId`.
+
+When set to `true`, `businessTaxId` must contain a valid VAT ID.
+
+::: tip
+This setting strictly toggles input validation and has no impact on tax configuration or behavior elsewhere in the system.
+:::
+
+
+
+## Payments
+
+### `allowPartialPaymentOnCheckout`
+
+
+
+Allowed types
+: [boolean](https://php.net/language.types.boolean)
+
+Default value
+: `false`
+
+Defined by
+: [Settings::$allowPartialPaymentOnCheckout](commerce4:craft\commerce\models\Settings::$allowPartialPaymentOnCheckout)
+
+
+
+Whether [partial payment](making-payments.md#checkout-with-partial-payment) can be made from the front end when the gateway allows them.
+
+The `false` default does not allow partial payments on the front end.
+
+
+
+### `gatewayPostRedirectTemplate`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `''`
+
+Defined by
+: [Settings::$gatewayPostRedirectTemplate](commerce4:craft\commerce\models\Settings::$gatewayPostRedirectTemplate)
+
+
+
+The path to the template that should be used to perform POST requests to offsite payment gateways.
+
+The template must contain a form that posts to the URL supplied by the `actionUrl` variable and outputs all hidden inputs with
+the `inputs` variable.
+
+```twig
+
+
+
+
+ Redirecting...
+
+
+
+
+
+```
+
+::: tip
+Since this template is simply used for redirecting, it only appears for a few seconds, so we suggest making it load fast with minimal
+images and inline styles to reduce HTTP requests.
+:::
+
+If empty (default), each gateway will decide how to handle after-payment redirects.
+
+
+
+### `paymentCurrency`
+
+
+
+Allowed types
+: [array](https://php.net/language.types.array), [null](https://php.net/language.types.null)
+
+Default value
+: `null`
+
+Defined by
+: [Settings::$paymentCurrency](commerce4:craft\commerce\models\Settings::$paymentCurrency)
+
+
+
+ISO codes for supported payment currencies.
+
+See [Payment Currencies](payment-currencies.md).
+
+
+
+## Units
+
+### `dimensionUnits`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'mm'`
+
+Defined by
+: [Settings::$dimensionUnits](commerce4:craft\commerce\models\Settings::$dimensionUnits)
+
+
+
+Unit type for dimension measurements.
+
+Options:
+
+- `'mm'`
+- `'cm'`
+- `'m'`
+- `'ft'`
+- `'in'`
+
+
+
+### `weightUnits`
+
+
+
+Allowed types
+: [string](https://php.net/language.types.string)
+
+Default value
+: `'g'`
+
+Defined by
+: [Settings::$weightUnits](commerce4:craft\commerce\models\Settings::$weightUnits)
+
+
+
+Units to be used for weight measurements.
+
+Options:
+
+- `'g'`
+- `'kg'`
+- `'lb'`
+
+
+
+
+
diff --git a/docs/commerce/4.x/event-data/events.json b/docs/.artifacts/commerce/4.x/events.json
similarity index 97%
rename from docs/commerce/4.x/event-data/events.json
rename to docs/.artifacts/commerce/4.x/events.json
index 7e7428424..fcf430cd9 100644
--- a/docs/commerce/4.x/event-data/events.json
+++ b/docs/.artifacts/commerce/4.x/events.json
@@ -2458,6 +2458,24 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\console\\controllers\\GatewaysController",
+ "name": "EVENT_DEFINE_ACTIONS",
+ "type": "craft\\events\\DefineConsoleActionsEvent",
+ "desc": "The event that is triggered when defining custom actions for this controller."
+ },
+ {
+ "class": "craft\\commerce\\console\\controllers\\GatewaysController",
+ "name": "EVENT_BEFORE_ACTION",
+ "type": "yii\\base\\ActionEvent",
+ "desc": "an event raised right before executing a controller action. You may set `ActionEvent::isValid` to be false to cancel the action execution."
+ },
+ {
+ "class": "craft\\commerce\\console\\controllers\\GatewaysController",
+ "name": "EVENT_AFTER_ACTION",
+ "type": "yii\\base\\ActionEvent",
+ "desc": "an event raised right after executing a controller action."
+ },
{
"class": "craft\\commerce\\console\\controllers\\ResetDataController",
"name": "EVENT_DEFINE_ACTIONS",
@@ -2512,6 +2530,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseAdminController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseAdminController",
"name": "EVENT_BEFORE_ACTION",
@@ -2524,6 +2548,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseController",
"name": "EVENT_BEFORE_ACTION",
@@ -2536,6 +2566,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseCpController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseCpController",
"name": "EVENT_BEFORE_ACTION",
@@ -2554,6 +2590,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseFrontEndController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseFrontEndController",
"name": "EVENT_BEFORE_ACTION",
@@ -2566,6 +2608,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseShippingSettingsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseShippingSettingsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2578,6 +2626,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseStoreSettingsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseStoreSettingsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2590,6 +2644,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\BaseTaxSettingsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\BaseTaxSettingsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2608,6 +2668,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\CartController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\CartController",
"name": "EVENT_BEFORE_ACTION",
@@ -2620,6 +2686,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\DiscountsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\DiscountsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2632,6 +2704,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\DonationsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\DonationsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2650,6 +2728,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\DownloadsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\DownloadsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2662,6 +2746,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\EmailPreviewController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\EmailPreviewController",
"name": "EVENT_BEFORE_ACTION",
@@ -2674,6 +2764,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\EmailsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\EmailsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2686,6 +2782,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\FormulasController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\FormulasController",
"name": "EVENT_BEFORE_ACTION",
@@ -2698,6 +2800,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\GatewaysController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\GatewaysController",
"name": "EVENT_BEFORE_ACTION",
@@ -2710,6 +2818,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\LineItemStatusesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\LineItemStatusesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2722,6 +2836,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\LiteShippingController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\LiteShippingController",
"name": "EVENT_BEFORE_ACTION",
@@ -2734,6 +2854,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\LiteTaxController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\LiteTaxController",
"name": "EVENT_BEFORE_ACTION",
@@ -2746,6 +2872,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\OrderSettingsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\OrderSettingsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2758,6 +2890,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\OrderStatusesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\OrderStatusesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2770,6 +2908,18 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\OrdersController",
+ "name": "EVENT_MODIFY_PURCHASABLES_TABLE_QUERY",
+ "type": "craft\\commerce\\controllers\\Event",
+ "desc": "The event that’s triggered when retrieving the purchasables for the add line item table on the order edit page."
+ },
+ {
+ "class": "craft\\commerce\\controllers\\OrdersController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\OrdersController",
"name": "EVENT_BEFORE_ACTION",
@@ -2782,6 +2932,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\PaymentCurrenciesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PaymentCurrenciesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2800,6 +2956,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\PaymentSourcesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PaymentSourcesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2818,6 +2980,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\PaymentsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PaymentsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2830,6 +2998,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\PdfsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PdfsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2842,6 +3016,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\PlansController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PlansController",
"name": "EVENT_BEFORE_ACTION",
@@ -2854,6 +3034,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ProductTypesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ProductTypesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2866,6 +3052,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ProductsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ProductsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2878,6 +3070,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ProductsPreviewController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ProductsPreviewController",
"name": "EVENT_BEFORE_ACTION",
@@ -2890,6 +3088,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\PromotionsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\PromotionsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2902,6 +3106,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\SalesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\SalesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2914,6 +3124,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\SettingsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\SettingsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2926,6 +3142,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ShippingCategoriesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ShippingCategoriesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2938,6 +3160,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ShippingMethodsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ShippingMethodsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2950,6 +3178,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ShippingRulesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ShippingRulesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2962,6 +3196,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\ShippingZonesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\ShippingZonesController",
"name": "EVENT_BEFORE_ACTION",
@@ -2974,6 +3214,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\StoreController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\StoreController",
"name": "EVENT_BEFORE_ACTION",
@@ -2986,6 +3232,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\SubscriptionsController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\SubscriptionsController",
"name": "EVENT_BEFORE_ACTION",
@@ -2998,6 +3250,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\TaxCategoriesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\TaxCategoriesController",
"name": "EVENT_BEFORE_ACTION",
@@ -3010,6 +3268,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\TaxRatesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\TaxRatesController",
"name": "EVENT_BEFORE_ACTION",
@@ -3022,6 +3286,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\TaxZonesController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\TaxZonesController",
"name": "EVENT_BEFORE_ACTION",
@@ -3040,6 +3310,12 @@
"type": "craft\\commerce\\controllers\\Event",
"desc": "The event that’s triggered when a cart is returned as an array for Ajax cart update requests."
},
+ {
+ "class": "craft\\commerce\\controllers\\UserOrdersController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\UserOrdersController",
"name": "EVENT_BEFORE_ACTION",
@@ -3052,6 +3328,12 @@
"type": "yii\\base\\ActionEvent",
"desc": "an event raised right after executing a controller action."
},
+ {
+ "class": "craft\\commerce\\controllers\\WebhooksController",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
{
"class": "craft\\commerce\\controllers\\WebhooksController",
"name": "EVENT_BEFORE_ACTION",
@@ -14881,6 +15163,216 @@
"type": "yii\\base\\Event",
"desc": "an event raised at the end of `validate()`"
},
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductTypeConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantHasUnlimitedStockConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantPriceConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantSkuConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_INIT",
+ "type": "yii\\base\\Event",
+ "desc": "The event that is triggered after the model's init cycle"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_DEFINE_BEHAVIORS",
+ "type": "craft\\events\\DefineBehaviorsEvent",
+ "desc": "The event that is triggered when defining the class behaviors"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_DEFINE_RULES",
+ "type": "craft\\events\\DefineRulesEvent",
+ "desc": "The event that is triggered when defining the model rules"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_DEFINE_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_DEFINE_EXTRA_FIELDS",
+ "type": "craft\\events\\DefineFieldsEvent",
+ "desc": "The event that is triggered when defining the extra arrayable fields"
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_BEFORE_VALIDATE",
+ "type": "yii\\base\\ModelEvent",
+ "desc": "an event raised at the beginning of `validate()`. You may set `ModelEvent::isValid` to be false to stop the validation."
+ },
+ {
+ "class": "craft\\commerce\\elements\\conditions\\products\\ProductVariantStockConditionRule",
+ "name": "EVENT_AFTER_VALIDATE",
+ "type": "yii\\base\\Event",
+ "desc": "an event raised at the end of `validate()`"
+ },
{
"class": "craft\\commerce\\elements\\conditions\\users\\DiscountGroupConditionRule",
"name": "EVENT_INIT",
@@ -14974,13 +15466,13 @@
{
"class": "craft\\commerce\\elements\\db\\DonationQuery",
"name": "EVENT_BEFORE_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the beginning of preparing an element query for the query builder."
},
{
"class": "craft\\commerce\\elements\\db\\DonationQuery",
"name": "EVENT_AFTER_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the end of preparing an element query for the query builder."
},
{
@@ -14989,6 +15481,12 @@
"type": "craft\\events\\DefineValueEvent",
"desc": "An event that is triggered when defining the cache tags that should be associated with the query."
},
+ {
+ "class": "craft\\commerce\\elements\\db\\DonationQuery",
+ "name": "EVENT_BEFORE_POPULATE_ELEMENT",
+ "type": "craft\\events\\PopulateElementEvent",
+ "desc": "The event that is triggered before an element is populated."
+ },
{
"class": "craft\\commerce\\elements\\db\\DonationQuery",
"name": "EVENT_AFTER_POPULATE_ELEMENT",
@@ -15016,13 +15514,13 @@
{
"class": "craft\\commerce\\elements\\db\\OrderQuery",
"name": "EVENT_BEFORE_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the beginning of preparing an element query for the query builder."
},
{
"class": "craft\\commerce\\elements\\db\\OrderQuery",
"name": "EVENT_AFTER_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the end of preparing an element query for the query builder."
},
{
@@ -15031,6 +15529,12 @@
"type": "craft\\events\\DefineValueEvent",
"desc": "An event that is triggered when defining the cache tags that should be associated with the query."
},
+ {
+ "class": "craft\\commerce\\elements\\db\\OrderQuery",
+ "name": "EVENT_BEFORE_POPULATE_ELEMENT",
+ "type": "craft\\events\\PopulateElementEvent",
+ "desc": "The event that is triggered before an element is populated."
+ },
{
"class": "craft\\commerce\\elements\\db\\OrderQuery",
"name": "EVENT_AFTER_POPULATE_ELEMENT",
@@ -15058,13 +15562,13 @@
{
"class": "craft\\commerce\\elements\\db\\ProductQuery",
"name": "EVENT_BEFORE_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the beginning of preparing an element query for the query builder."
},
{
"class": "craft\\commerce\\elements\\db\\ProductQuery",
"name": "EVENT_AFTER_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the end of preparing an element query for the query builder."
},
{
@@ -15073,6 +15577,12 @@
"type": "craft\\events\\DefineValueEvent",
"desc": "An event that is triggered when defining the cache tags that should be associated with the query."
},
+ {
+ "class": "craft\\commerce\\elements\\db\\ProductQuery",
+ "name": "EVENT_BEFORE_POPULATE_ELEMENT",
+ "type": "craft\\events\\PopulateElementEvent",
+ "desc": "The event that is triggered before an element is populated."
+ },
{
"class": "craft\\commerce\\elements\\db\\ProductQuery",
"name": "EVENT_AFTER_POPULATE_ELEMENT",
@@ -15100,13 +15610,13 @@
{
"class": "craft\\commerce\\elements\\db\\SubscriptionQuery",
"name": "EVENT_BEFORE_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the beginning of preparing an element query for the query builder."
},
{
"class": "craft\\commerce\\elements\\db\\SubscriptionQuery",
"name": "EVENT_AFTER_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the end of preparing an element query for the query builder."
},
{
@@ -15115,6 +15625,12 @@
"type": "craft\\events\\DefineValueEvent",
"desc": "An event that is triggered when defining the cache tags that should be associated with the query."
},
+ {
+ "class": "craft\\commerce\\elements\\db\\SubscriptionQuery",
+ "name": "EVENT_BEFORE_POPULATE_ELEMENT",
+ "type": "craft\\events\\PopulateElementEvent",
+ "desc": "The event that is triggered before an element is populated."
+ },
{
"class": "craft\\commerce\\elements\\db\\SubscriptionQuery",
"name": "EVENT_AFTER_POPULATE_ELEMENT",
@@ -15142,13 +15658,13 @@
{
"class": "craft\\commerce\\elements\\db\\VariantQuery",
"name": "EVENT_BEFORE_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the beginning of preparing an element query for the query builder."
},
{
"class": "craft\\commerce\\elements\\db\\VariantQuery",
"name": "EVENT_AFTER_PREPARE",
- "type": "craft\\elements\\db\\Event",
+ "type": "craft\\events\\CancelableEvent",
"desc": "An event that is triggered at the end of preparing an element query for the query builder."
},
{
@@ -15157,6 +15673,12 @@
"type": "craft\\events\\DefineValueEvent",
"desc": "An event that is triggered when defining the cache tags that should be associated with the query."
},
+ {
+ "class": "craft\\commerce\\elements\\db\\VariantQuery",
+ "name": "EVENT_BEFORE_POPULATE_ELEMENT",
+ "type": "craft\\events\\PopulateElementEvent",
+ "desc": "The event that is triggered before an element is populated."
+ },
{
"class": "craft\\commerce\\elements\\db\\VariantQuery",
"name": "EVENT_AFTER_POPULATE_ELEMENT",
diff --git a/docs/.artifacts/commerce/4.x/orders-carts.md b/docs/.artifacts/commerce/4.x/orders-carts.md
new file mode 100644
index 000000000..0fe7b82cb
--- /dev/null
+++ b/docs/.artifacts/commerce/4.x/orders-carts.md
@@ -0,0 +1,1488 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only orders that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching orders as arrays of data, rather than [Order](commerce4:craft\commerce\elements\Order) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [customer](#customer) | Narrows the query results based on the customer’s user account.
+| [customerId](#customerid) | Narrows the query results based on the customer, per their user ID.
+| [dateAuthorized](#dateauthorized) | Narrows the query results based on the orders’ authorized dates.
+| [dateCreated](#datecreated) | Narrows the query results based on the orders’ creation dates.
+| [dateOrdered](#dateordered) | Narrows the query results based on the orders’ completion dates.
+| [datePaid](#datepaid) | Narrows the query results based on the orders’ paid dates.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the orders’ last-updated dates.
+| [email](#email) | Narrows the query results based on the customers’ email addresses.
+| [expiryDate](#expirydate) | Narrows the query results based on the orders’ expiry dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [gateway](#gateway) | Narrows the query results based on the gateway.
+| [gatewayId](#gatewayid) | Narrows the query results based on the gateway, per its ID.
+| [hasLineItems](#haslineitems) | Narrows the query results to only orders that have line items.
+| [hasPurchasables](#haspurchasables) | Narrows the query results to only orders that have certain purchasables.
+| [hasTransactions](#hastransactions) | Narrows the query results to only carts that have at least one transaction.
+| [id](#id) |
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching orders as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [isCompleted](#iscompleted) | Narrows the query results to only orders that are completed.
+| [isPaid](#ispaid) | Narrows the query results to only orders that are paid.
+| [isUnpaid](#isunpaid) | Narrows the query results to only orders that are not paid.
+| [itemSubtotal](#itemsubtotal) | Narrows the query results based on the order’s item subtotal.
+| [itemTotal](#itemtotal) | Narrows the query results based on the order’s item total.
+| [limit](#limit) | Determines the number of orders that should be returned.
+| [number](#number) | Narrows the query results based on the order number.
+| [offset](#offset) | Determines how many orders should be skipped in the results.
+| [orderBy](#orderby) | Determines the order that the orders should be returned in. (If empty, defaults to `id ASC`.)
+| [orderLanguage](#orderlanguage) | Narrows the query results based on the order language, per the language string provided.
+| [orderSiteId](#ordersiteid) | Narrows the query results based on the order language, per the language string provided.
+| [orderStatus](#orderstatus) | Narrows the query results based on the order statuses.
+| [orderStatusId](#orderstatusid) | Narrows the query results based on the order statuses, per their IDs.
+| [origin](#origin) | Narrows the query results based on the origin.
+| [preferSites](#prefersites) | If [unique()](https://docs.craftcms.com/api/v4/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [reference](#reference) | Narrows the query results based on the order reference.
+| [relatedTo](#relatedto) | Narrows the query results to only orders that are related to certain other elements.
+| [search](#search) | Narrows the query results to only orders that match a search query.
+| [shippingMethodHandle](#shippingmethodhandle) | Narrows the query results based on the shipping method handle.
+| [shortNumber](#shortnumber) | Narrows the query results based on the order short number.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the orders’ IDs in the `elements_sites` table.
+| [total](#total) | Narrows the query results based on the total.
+| [totalDiscount](#totaldiscount) | Narrows the query results based on the total discount.
+| [totalPaid](#totalpaid) | Narrows the query results based on the total paid amount.
+| [totalPrice](#totalprice) | Narrows the query results based on the total price.
+| [totalQty](#totalqty) | Narrows the query results based on the total qty of items.
+| [totalTax](#totaltax) | Narrows the query results based on the total tax.
+| [trashed](#trashed) | Narrows the query results to only orders that have been soft-deleted.
+| [uid](#uid) | Narrows the query results based on the orders’ UIDs.
+| [with](#with) | Causes the query to return matching orders eager-loaded with related elements.
+| [withAddresses](#withaddresses) | Eager loads the the shipping and billing addressees on the resulting orders.
+| [withAdjustments](#withadjustments) | Eager loads the order adjustments on the resulting orders.
+| [withAll](#withall) | Eager loads all relational data (addresses, adjustents, customers, line items, transactions) for the resulting orders.
+| [withCustomer](#withcustomer) | Eager loads the user on the resulting orders.
+| [withLineItems](#withlineitems) | Eager loads the line items on the resulting orders.
+| [withTransactions](#withtransactions) | Eager loads the transactions on the resulting orders.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only orders that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all orders that are related to myCategoryA and myCategoryB #}
+{% set orders = craft.orders()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all orders that are related to $myCategoryA and $myCategoryB
+$orders = \craft\commerce\elements\Order::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching orders as arrays of data, rather than [Order](commerce4:craft\commerce\elements\Order) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders as arrays #}
+{% set orders = craft.orders()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch orders as arrays
+$orders = \craft\commerce\elements\Order::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `customer`
+
+Narrows the query results based on the customer’s user account.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a customer with a user account ID of 1.
+| a [User](https://docs.craftcms.com/api/v4/craft-elements-user.html) object | with a customer with a user account represented by the object.
+| `'not 1'` | not the user account with an ID 1.
+| `[1, 2]` | with an user account ID of 1 or 2.
+| `['not', 1, 2]` | not with a user account ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customer(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customer($user)
+ ->all();
+```
+:::
+
+
+#### `customerId`
+
+Narrows the query results based on the customer, per their user ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a user with an ID of 1.
+| `'not 1'` | not with a user with an ID of 1.
+| `[1, 2]` | with a user with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a user with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's orders #}
+{% set orders = craft.orders()
+ .customerId(currentUser.id)
+ .all() %}
+```
+
+```php
+// Fetch the current user's orders
+$user = Craft::$app->user->getIdentity();
+$orders = \craft\commerce\elements\Order::find()
+ ->customerId($user->id)
+ ->all();
+```
+:::
+
+
+#### `dateAuthorized`
+
+Narrows the query results based on the orders’ authorized dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were authorized on or after 2018-04-01.
+| `'< 2018-05-01'` | that were authorized before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were authorized recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateAuthorized(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were authorized recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateAuthorized(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateCreated`
+
+Narrows the query results based on the orders’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch orders created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set orders = craft.orders()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch orders created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateOrdered`
+
+Narrows the query results based on the orders’ completion dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were completed on or after 2018-04-01.
+| `'< 2018-05-01'` | that were completed before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were completed recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateOrdered(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were completed recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateOrdered(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `datePaid`
+
+Narrows the query results based on the orders’ paid dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were paid on or after 2018-04-01.
+| `'< 2018-05-01'` | that were paid before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were completed between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders that were paid for recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set orders = craft.orders()
+ .datePaid(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch orders that were paid for recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->datePaid(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the orders’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch orders updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set orders = craft.orders()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch orders updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `email`
+
+Narrows the query results based on the customers’ email addresses.
+
+Possible values include:
+
+| Value | Fetches orders with customers…
+| - | -
+| `'foo@bar.baz'` | with an email of `foo@bar.baz`.
+| `'not foo@bar.baz'` | not with an email of `foo@bar.baz`.
+| `'*@bar.baz'` | with an email that ends with `@bar.baz`.
+
+
+
+::: code
+```twig
+{# Fetch orders from customers with a .co.uk domain on their email address #}
+{% set orders = craft.orders()
+ .email('*.co.uk')
+ .all() %}
+```
+
+```php
+// Fetch orders from customers with a .co.uk domain on their email address
+$orders = \craft\commerce\elements\Order::find()
+ ->email('*.co.uk')
+ ->all();
+```
+:::
+
+
+#### `expiryDate`
+
+Narrows the query results based on the orders’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch orders expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set orders = craft.orders()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch orders expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$orders = \craft\commerce\elements\Order::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch orders in a specific order #}
+{% set orders = craft.orders()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch orders in a specific order
+$orders = \craft\commerce\elements\Order::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `gateway`
+
+Narrows the query results based on the gateway.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [Gateway](commerce4:craft\commerce\base\Gateway) object | with a gateway represented by the object.
+
+
+
+
+#### `gatewayId`
+
+Narrows the query results based on the gateway, per its ID.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with a gateway with an ID of 1.
+| `'not 1'` | not with a gateway with an ID of 1.
+| `[1, 2]` | with a gateway with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a gateway with an ID of 1 or 2.
+
+
+
+
+#### `hasLineItems`
+
+Narrows the query results to only orders that have line items.
+
+
+
+::: code
+```twig
+{# Fetch orders that do or do not have line items #}
+{% set orders = craft.orders()
+ .hasLineItems()
+ .all() %}
+```
+
+```php
+// Fetch unpaid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->hasLineItems()
+ ->all();
+```
+:::
+
+
+#### `hasPurchasables`
+
+Narrows the query results to only orders that have certain purchasables.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| a [PurchasableInterface](commerce4:craft\commerce\base\PurchasableInterface) object | with a purchasable represented by the object.
+| an array of [PurchasableInterface](commerce4:craft\commerce\base\PurchasableInterface) objects | with all the purchasables represented by the objects.
+
+
+
+
+#### `hasTransactions`
+
+Narrows the query results to only carts that have at least one transaction.
+
+
+
+::: code
+```twig
+{# Fetch carts that have attempted payments #}
+{% set orders = craft.orders()
+ .hasTransactions()
+ .all() %}
+```
+
+```php
+// Fetch carts that have attempted payments
+$orders = \craft\commerce\elements\Order::find()
+ ->hasTransactions()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+
+
+
+
+
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching orders as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch orders in reverse #}
+{% set orders = craft.orders()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch orders in reverse
+$orders = \craft\commerce\elements\Order::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `isCompleted`
+
+Narrows the query results to only orders that are completed.
+
+
+
+::: code
+```twig
+{# Fetch completed orders #}
+{% set orders = craft.orders()
+ .isCompleted()
+ .all() %}
+```
+
+```php
+// Fetch completed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isCompleted()
+ ->all();
+```
+:::
+
+
+#### `isPaid`
+
+Narrows the query results to only orders that are paid.
+
+
+
+::: code
+```twig
+{# Fetch paid orders #}
+{% set orders = craft.orders()
+ .isPaid()
+ .all() %}
+```
+
+```php
+// Fetch paid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isPaid()
+ ->all();
+```
+:::
+
+
+#### `isUnpaid`
+
+Narrows the query results to only orders that are not paid.
+
+
+
+::: code
+```twig
+{# Fetch unpaid orders #}
+{% set orders = craft.orders()
+ .isUnpaid()
+ .all() %}
+```
+
+```php
+// Fetch unpaid orders
+$orders = \craft\commerce\elements\Order::find()
+ ->isUnpaid()
+ ->all();
+```
+:::
+
+
+#### `itemSubtotal`
+
+Narrows the query results based on the order’s item subtotal.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `100` | with an item subtotal of 0.
+| `'< 1000000'` | with an item subtotal of less than ,000,000.
+| `['>= 10', '< 100']` | with an item subtotal of between and 0.
+
+
+
+
+#### `itemTotal`
+
+Narrows the query results based on the order’s item total.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `100` | with an item total of 0.
+| `'< 1000000'` | with an item total of less than ,000,000.
+| `['>= 10', '< 100']` | with an item total of between and 0.
+
+
+
+
+#### `limit`
+
+Determines the number of orders that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 orders #}
+{% set orders = craft.orders()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 orders
+$orders = \craft\commerce\elements\Order::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `number`
+
+Narrows the query results based on the order number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('number') %}
+{% set order = craft.orders()
+ .number(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('number');
+$order = \craft\commerce\elements\Order::find()
+ ->number($orderNumber)
+ ->one();
+```
+:::
+
+
+#### `offset`
+
+Determines how many orders should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all orders except for the first 3 #}
+{% set orders = craft.orders()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all orders except for the first 3
+$orders = \craft\commerce\elements\Order::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the orders should be returned in. (If empty, defaults to `id ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all orders in order of date created #}
+{% set orders = craft.orders()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all orders in order of date created
+$orders = \craft\commerce\elements\Order::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `orderLanguage`
+
+Narrows the query results based on the order language, per the language string provided.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'en'` | with an order language that is `'en'`.
+| `'not en'` | not with an order language that is not `'en'`.
+| `['en', 'en-us']` | with an order language that is `'en'` or `'en-us'`.
+| `['not', 'en']` | not with an order language that is not `'en'`.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order language that is `'en'` #}
+{% set orders = craft.orders()
+ .orderLanguage('en')
+ .all() %}
+```
+
+```php
+// Fetch orders with an order language that is `'en'`
+$orders = \craft\commerce\elements\Order::find()
+ ->orderLanguage('en')
+ ->all();
+```
+:::
+
+
+#### `orderSiteId`
+
+Narrows the query results based on the order language, per the language string provided.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an order site ID of 1.
+| `'not 1'` | not with an order site ID that is no 1.
+| `[1, 2]` | with an order site ID of 1 or 2.
+| `['not', 1, 2]` | not with an order site ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order site ID of 1 #}
+{% set orders = craft.orders()
+ .orderSiteId(1)
+ .all() %}
+```
+
+```php
+// Fetch orders with an order site ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->orderSiteId(1)
+ ->all();
+```
+:::
+
+
+#### `orderStatus`
+
+Narrows the query results based on the order statuses.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'foo'` | with an order status with a handle of `foo`.
+| `'not foo'` | not with an order status with a handle of `foo`.
+| `['foo', 'bar']` | with an order status with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with an order status with a handle of `foo` or `bar`.
+| a [OrderStatus](commerce4:craft\commerce\models\OrderStatus) object | with an order status represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch shipped orders #}
+{% set orders = craft.orders()
+ .orderStatus('shipped')
+ .all() %}
+```
+
+```php
+// Fetch shipped orders
+$orders = \craft\commerce\elements\Order::find()
+ ->orderStatus('shipped')
+ ->all();
+```
+:::
+
+
+#### `orderStatusId`
+
+Narrows the query results based on the order statuses, per their IDs.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an order status with an ID of 1.
+| `'not 1'` | not with an order status with an ID of 1.
+| `[1, 2]` | with an order status with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an order status with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch orders with an order status with an ID of 1 #}
+{% set orders = craft.orders()
+ .orderStatusId(1)
+ .all() %}
+```
+
+```php
+// Fetch orders with an order status with an ID of 1
+$orders = \craft\commerce\elements\Order::find()
+ ->orderStatusId(1)
+ ->all();
+```
+:::
+
+
+#### `origin`
+
+Narrows the query results based on the origin.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'web'` | with an origin of `web`.
+| `'not remote'` | not with an origin of `remote`.
+| `['web', 'cp']` | with an order origin of `web` or `cp`.
+| `['not', 'remote', 'cp']` | not with an origin of `web` or `cp`.
+
+
+
+::: code
+```twig
+{# Fetch shipped orders #}
+{% set orders = craft.orders()
+ .origin('web')
+ .all() %}
+```
+
+```php
+// Fetch shipped orders
+$orders = \craft\commerce\elements\Order::find()
+ ->origin('web')
+ ->all();
+```
+:::
+
+
+#### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v4/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique orders from Site A, or Site B if they don’t exist in Site A #}
+{% set orders = craft.orders()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique orders from Site A, or Site B if they don’t exist in Site A
+$orders = \craft\commerce\elements\Order::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `reference`
+
+Narrows the query results based on the order reference.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'Foo'` | with a reference of `Foo`.
+| `'Foo*'` | with a reference that begins with `Foo`.
+| `'*Foo'` | with a reference that ends with `Foo`.
+| `'*Foo*'` | with a reference that contains `Foo`.
+| `'not *Foo*'` | with a reference that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a reference that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a reference that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderReference = craft.app.request.getQueryParam('ref') %}
+{% set order = craft.orders()
+ .reference(orderReference)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderReference = Craft::$app->request->getQueryParam('ref');
+$order = \craft\commerce\elements\Order::find()
+ ->reference($orderReference)
+ ->one();
+```
+:::
+
+
+#### `relatedTo`
+
+Narrows the query results to only orders that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all orders that are related to myCategory #}
+{% set orders = craft.orders()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all orders that are related to $myCategory
+$orders = \craft\commerce\elements\Order::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only orders that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all orders that match the search query #}
+{% set orders = craft.orders()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all orders that match the search query
+$orders = \craft\commerce\elements\Order::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `shippingMethodHandle`
+
+Narrows the query results based on the shipping method handle.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'foo'` | with a shipping method with a handle of `foo`.
+| `'not foo'` | not with a shipping method with a handle of `foo`.
+| `['foo', 'bar']` | with a shipping method with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not with a shipping method with a handle of `foo` or `bar`.
+| a `\craft\commerce\elements\db\ShippingMethod` object | with a shipping method represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch collection shipping method orders #}
+{% set orders = craft.orders()
+ .shippingMethodHandle('collection')
+ .all() %}
+```
+
+```php
+// Fetch collection shipping method orders
+$orders = \craft\commerce\elements\Order::find()
+ ->shippingMethodHandle('collection')
+ ->all();
+```
+:::
+
+
+#### `shortNumber`
+
+Narrows the query results based on the order short number.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `'xxxxxxx'` | with a matching order number
+
+
+
+::: code
+```twig
+{# Fetch the requested order #}
+{% set orderNumber = craft.app.request.getQueryParam('shortNumber') %}
+{% set order = craft.orders()
+ .shortNumber(orderNumber)
+ .one() %}
+```
+
+```php
+// Fetch the requested order
+$orderNumber = Craft::$app->request->getQueryParam('shortNumber');
+$order = \craft\commerce\elements\Order::find()
+ ->shortNumber($orderNumber)
+ ->one();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the orders’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the order by its ID in the elements_sites table #}
+{% set order = craft.orders()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the order by its ID in the elements_sites table
+$order = \craft\commerce\elements\Order::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `total`
+
+Narrows the query results based on the total.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total price of .
+| `['and', 10, 20]` | an order with a total of or .
+
+
+
+
+#### `totalDiscount`
+
+Narrows the query results based on the total discount.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total discount of 10.
+| `[10, 20]` | an order with a total discount of 10 or 20.
+
+
+
+
+#### `totalPaid`
+
+Narrows the query results based on the total paid amount.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total paid amount of .
+| `['and', 10, 20]` | an order with a total paid amount of or .
+
+
+
+
+#### `totalPrice`
+
+Narrows the query results based on the total price.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total price of .
+| `['and', 10, 20]` | an order with a total price of or .
+
+
+
+
+#### `totalQty`
+
+Narrows the query results based on the total qty of items.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total qty of 10.
+| `[10, 20]` | an order with a total qty of 10 or 20.
+
+
+
+
+#### `totalTax`
+
+Narrows the query results based on the total tax.
+
+Possible values include:
+
+| Value | Fetches orders…
+| - | -
+| `10` | with a total tax of 10.
+| `[10, 20]` | an order with a total tax of 10 or 20.
+
+
+
+
+#### `trashed`
+
+Narrows the query results to only orders that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed orders #}
+{% set orders = craft.orders()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed orders
+$orders = \craft\commerce\elements\Order::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `uid`
+
+Narrows the query results based on the orders’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the order by its UID #}
+{% set order = craft.orders()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the order by its UID
+$order = \craft\commerce\elements\Order::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching orders eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch orders eager-loaded with the "Related" field’s relations #}
+{% set orders = craft.orders()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch orders eager-loaded with the "Related" field’s relations
+$orders = \craft\commerce\elements\Order::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+#### `withAddresses`
+
+Eager loads the the shipping and billing addressees on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches addresses
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withAdjustments`
+
+Eager loads the order adjustments on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches adjustments
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withAll`
+
+Eager loads all relational data (addresses, adjustents, customers, line items, transactions) for the resulting orders.
+
+Possible values include:
+
+| Value | Fetches addresses, adjustents, customers, line items, transactions
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withCustomer`
+
+Eager loads the user on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches adjustments
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withLineItems`
+
+Eager loads the line items on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches line items
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+#### `withTransactions`
+
+Eager loads the transactions on the resulting orders.
+
+Possible values include:
+
+| Value | Fetches transactions…
+| - | -
+| bool | `true` to eager-load, `false` to not eager load.
+
+
+
+
+
+
diff --git a/docs/.artifacts/commerce/4.x/products-variants.md b/docs/.artifacts/commerce/4.x/products-variants.md
new file mode 100644
index 000000000..6b3ed6a74
--- /dev/null
+++ b/docs/.artifacts/commerce/4.x/products-variants.md
@@ -0,0 +1,2640 @@
+
+
+## Product Query Parameters
+
+Product queries support the following parameters:
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [after](#product-after) | Narrows the query results to only products that were posted on or after a certain date.
+| [afterPopulate](#product-afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#product-andrelatedto) | Narrows the query results to only products that are related to certain other elements.
+| [asArray](#product-asarray) | Causes the query to return matching products as arrays of data, rather than [Product](commerce4:craft\commerce\elements\Product) objects.
+| [availableForPurchase](#product-availableforpurchase) | Narrows the query results to only products that are available for purchase.
+| [before](#product-before) | Narrows the query results to only products that were posted before a certain date.
+| [cache](#product-cache) | Enables query cache for this Query.
+| [clearCachedResult](#product-clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [dateCreated](#product-datecreated) | Narrows the query results based on the products’ creation dates.
+| [dateUpdated](#product-dateupdated) | Narrows the query results based on the products’ last-updated dates.
+| [defaultHeight](#product-defaultheight) | Narrows the query results based on the products’ default variant height dimension IDs.
+| [defaultLength](#product-defaultlength) | Narrows the query results based on the products’ default variant length dimension IDs.
+| [defaultPrice](#product-defaultprice) | Narrows the query results based on the products’ default variant price.
+| [defaultSku](#product-defaultsku) | Narrows the query results based on the default productvariants defaultSku
+| [defaultWeight](#product-defaultweight) | Narrows the query results based on the products’ default variant weight dimension IDs.
+| [defaultWidth](#product-defaultwidth) | Narrows the query results based on the products’ default variant width dimension IDs.
+| [expiryDate](#product-expirydate) | Narrows the query results based on the products’ expiry dates.
+| [fixedOrder](#product-fixedorder) | Causes the query results to be returned in the order specified by [id](#product-id).
+| [hasVariant](#product-hasvariant) | Narrows the query results to only products that have certain variants.
+| [id](#product-id) | Narrows the query results based on the products’ IDs.
+| [ignorePlaceholders](#product-ignoreplaceholders) | Causes the query to return matching products as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#product-inreverse) | Causes the query results to be returned in reverse order.
+| [limit](#product-limit) | Determines the number of products that should be returned.
+| [offset](#product-offset) | Determines how many products should be skipped in the results.
+| [orderBy](#product-orderby) | Determines the order that the products should be returned in. (If empty, defaults to `postDate DESC`.)
+| [postDate](#product-postdate) | Narrows the query results based on the products’ post dates.
+| [preferSites](#product-prefersites) | If [unique](#product-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#product-preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [relatedTo](#product-relatedto) | Narrows the query results to only products that are related to certain other elements.
+| [search](#product-search) | Narrows the query results to only products that match a search query.
+| [shippingCategory](#product-shippingcategory) | Narrows the query results based on the products’ shipping category.
+| [shippingCategoryId](#product-shippingcategoryid) | Narrows the query results based on the products’ shipping categories, per the shipping categories’ IDs.
+| [site](#product-site) | Determines which site(s) the products should be queried in.
+| [siteId](#product-siteid) | Determines which site(s) the products should be queried in, per the site’s ID.
+| [siteSettingsId](#product-sitesettingsid) | Narrows the query results based on the products’ IDs in the `elements_sites` table.
+| [slug](#product-slug) | Narrows the query results based on the products’ slugs.
+| [status](#product-status) | Narrows the query results based on the products’ statuses.
+| [taxCategory](#product-taxcategory) | Narrows the query results based on the products’ tax category.
+| [taxCategoryId](#product-taxcategoryid) | Narrows the query results based on the products’ tax categories, per the tax categories’ IDs.
+| [title](#product-title) | Narrows the query results based on the products’ titles.
+| [trashed](#product-trashed) | Narrows the query results to only products that have been soft-deleted.
+| [type](#product-type) | Narrows the query results based on the products’ types.
+| [typeId](#product-typeid) | Narrows the query results based on the products’ types, per the types’ IDs.
+| [uid](#product-uid) | Narrows the query results based on the products’ UIDs.
+| [unique](#product-unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [uri](#product-uri) | Narrows the query results based on the products’ URIs.
+| [with](#product-with) | Causes the query to return matching products eager-loaded with related elements.
+
+
+
+
+
+ after
+
+Narrows the query results to only products that were posted on or after a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted after 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted after the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .after(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->after($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+ afterPopulate
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+
+
+Narrows the query results to only products that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all products that are related to myCategoryA and myCategoryB #}
+{% set products = craft.products()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all products that are related to $myCategoryA and $myCategoryB
+$products = \craft\commerce\elements\Product::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+ asArray
+
+Causes the query to return matching products as arrays of data, rather than [Product](commerce4:craft\commerce\elements\Product) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products as arrays #}
+{% set products = craft.products()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch products as arrays
+$products = \craft\commerce\elements\Product::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+ availableForPurchase
+
+Narrows the query results to only products that are available for purchase.
+
+
+
+::: code
+```twig
+{# Fetch products that are available for purchase #}
+{% set products = craft.products()
+ .availableForPurchase()
+ .all() %}
+```
+
+```php
+// Fetch products that are available for purchase
+$products = \craft\commerce\elements\Product::find()
+ ->availableForPurchase()
+ ->all();
+```
+:::
+
+
+ before
+
+Narrows the query results to only products that were posted before a certain date.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'2018-04-01'` | that were posted before 2018-04-01.
+| a [DateTime](https://php.net/class.datetime) object | that were posted before the date represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products posted before this month #}
+{% set firstDayOfMonth = date('first day of this month') %}
+
+{% set products = craft.products()
+ .before(firstDayOfMonth)
+ .all() %}
+```
+
+```php
+// Fetch products posted before this month
+$firstDayOfMonth = new \DateTime('first day of this month');
+
+$products = \craft\commerce\elements\Product::find()
+ ->before($firstDayOfMonth)
+ ->all();
+```
+:::
+
+
+ cache
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+ clearCachedResult
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+ dateCreated
+
+Narrows the query results based on the products’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch products created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ dateUpdated
+
+Narrows the query results based on the products’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch products updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set products = craft.products()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch products updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+ defaultHeight
+
+Narrows the query results based on the products’ default variant height dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultHeight(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultHeight(1)
+ ->all();
+```
+:::
+
+
+ defaultLength
+
+Narrows the query results based on the products’ default variant length dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultLength(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultLength(1)
+ ->all();
+```
+:::
+
+
+ defaultPrice
+
+Narrows the query results based on the products’ default variant price.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `10` | of a price of 10.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a default variant price between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product type with an ID of 1 #}
+{% set products = craft.products()
+ .defaultPrice(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product type with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultPrice(1)
+ ->all();
+```
+:::
+
+
+ defaultSku
+
+Narrows the query results based on the default productvariants defaultSku
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `xxx-001` | of products default SKU of `xxx-001`.
+| `'not xxx-001'` | not a default SKU of `xxx-001`.
+| `['not xxx-001', 'not xxx-002']` | of a default SKU of xxx-001 or xxx-002.
+| `['not', `xxx-001`, `xxx-002`]` | not a product default SKU of `xxx-001` or `xxx-001`.
+
+
+
+::: code
+```twig
+{# Fetch products of the product default SKU of `xxx-001` #}
+{% set products = craft.products()
+ .defaultSku('xxx-001')
+ .all() %}
+```
+
+```php
+// Fetch products of the product default SKU of `xxx-001`
+$products = \craft\commerce\elements\Product::find()
+ ->defaultSku('xxx-001')
+ ->all();
+```
+:::
+
+
+ defaultWeight
+
+Narrows the query results based on the products’ default variant weight dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultWeight(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultWeight(1)
+ ->all();
+```
+:::
+
+
+ defaultWidth
+
+Narrows the query results based on the products’ default variant width dimension IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with a dimension of 1.
+| `'not 1'` | not a dimension of 1.
+| `[1, 2]` | of a a dimension 1 or 2.
+| `['and', '>= ' ~ 100, '<= ' ~ 2000]` | of a dimension between 100 and 2000
+
+
+
+::: code
+```twig
+{# Fetch products of the product default dimension of 1 #}
+{% set products = craft.products()
+ .defaultWidth(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product default dimension of 1
+$products = \craft\commerce\elements\Product::find()
+ ->defaultWidth(1)
+ ->all();
+```
+:::
+
+
+ expiryDate
+
+Narrows the query results based on the products’ expiry dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2020-04-01'` | that will expire on or after 2020-04-01.
+| `'< 2020-05-01'` | that will expire before 2020-05-01
+| `['and', '>= 2020-04-04', '< 2020-05-01']` | that will expire between 2020-04-01 and 2020-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products expiring this month #}
+{% set nextMonth = date('first day of next month')|atom %}
+
+{% set products = craft.products()
+ .expiryDate("< #{nextMonth}")
+ .all() %}
+```
+
+```php
+// Fetch products expiring this month
+$nextMonth = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->expiryDate("< {$nextMonth}")
+ ->all();
+```
+:::
+
+
+ fixedOrder
+
+Causes the query results to be returned in the order specified by [id](#product-id).
+
+
+
+::: tip
+If no IDs were passed to [id](#product-id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch products in a specific order #}
+{% set products = craft.products()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch products in a specific order
+$products = \craft\commerce\elements\Product::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+ hasVariant
+
+Narrows the query results to only products that have certain variants.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| a [VariantQuery](commerce4:craft\commerce\elements\db\VariantQuery) object | with variants that match the query.
+
+
+
+
+ id
+
+Narrows the query results based on the products’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the product by its ID #}
+{% set product = craft.products()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the product by its ID
+$product = \craft\commerce\elements\Product::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#product-fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+ ignorePlaceholders
+
+Causes the query to return matching products as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+ inReverse
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch products in reverse #}
+{% set products = craft.products()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch products in reverse
+$products = \craft\commerce\elements\Product::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+ limit
+
+Determines the number of products that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 products #}
+{% set products = craft.products()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 products
+$products = \craft\commerce\elements\Product::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+ offset
+
+Determines how many products should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all products except for the first 3 #}
+{% set products = craft.products()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all products except for the first 3
+$products = \craft\commerce\elements\Product::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+ orderBy
+
+Determines the order that the products should be returned in. (If empty, defaults to `postDate DESC`.)
+
+
+
+::: code
+```twig
+{# Fetch all products in order of date created #}
+{% set products = craft.products()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all products in order of date created
+$products = \craft\commerce\elements\Product::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+ postDate
+
+Narrows the query results based on the products’ post dates.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'>= 2018-04-01'` | that were posted on or after 2018-04-01.
+| `'< 2018-05-01'` | that were posted before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were posted between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch products posted last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set products = craft.products()
+ .postDate(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch products posted last month
+$start = new \DateTime('first day of next month')->format(\DateTime::ATOM);
+$end = new \DateTime('first day of this month')->format(\DateTime::ATOM);
+
+$products = \craft\commerce\elements\Product::find()
+ ->postDate(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ preferSites
+
+If [unique](#product-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique products from Site A, or Site B if they don’t exist in Site A #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique products from Site A, or Site B if they don’t exist in Site A
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+ prepareSubquery
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+
+
+Narrows the query results to only products that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all products that are related to myCategory #}
+{% set products = craft.products()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all products that are related to $myCategory
+$products = \craft\commerce\elements\Product::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+ search
+
+Narrows the query results to only products that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all products that match the search query #}
+{% set products = craft.products()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all products that match the search query
+$products = \craft\commerce\elements\Product::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+ shippingCategory
+
+Narrows the query results based on the products’ shipping category.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | of a shipping category with a handle of `foo`.
+| `'not foo'` | not of a shipping category with a handle of `foo`.
+| `['foo', 'bar']` | of a shipping category with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a shipping category with a handle of `foo` or `bar`.
+| an [ShippingCategory](commerce4:craft\commerce\models\ShippingCategory) object | of a shipping category represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products with a Foo shipping category #}
+{% set products = craft.products()
+ .shippingCategory('foo')
+ .all() %}
+```
+
+```php
+// Fetch products with a Foo shipping category
+$products = \craft\commerce\elements\Product::find()
+ ->shippingCategory('foo')
+ ->all();
+```
+:::
+
+
+ shippingCategoryId
+
+Narrows the query results based on the products’ shipping categories, per the shipping categories’ IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a shipping category with an ID of 1.
+| `'not 1'` | not of a shipping category with an ID of 1.
+| `[1, 2]` | of a shipping category with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a shipping category with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch products of the shipping category with an ID of 1 #}
+{% set products = craft.products()
+ .shippingCategoryId(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the shipping category with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->shippingCategoryId(1)
+ ->all();
+```
+:::
+
+
+ site
+
+Determines which site(s) the products should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](https://docs.craftcms.com/api/v4/craft-models-site.html) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#product-unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch products from the Foo site #}
+{% set products = craft.products()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch products from the Foo site
+$products = \craft\commerce\elements\Product::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+ siteId
+
+Determines which site(s) the products should be queried in, per the site’s ID.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | from the site with an ID of `1`.
+| `[1, 2]` | from a site with an ID of `1` or `2`.
+| `['not', 1, 2]` | not in a site with an ID of `1` or `2`.
+| `'*'` | from any site.
+
+
+
+::: code
+```twig
+{# Fetch products from the site with an ID of 1 #}
+{% set products = craft.products()
+ .siteId(1)
+ .all() %}
+```
+
+```php
+// Fetch products from the site with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->siteId(1)
+ ->all();
+```
+:::
+
+
+ siteSettingsId
+
+Narrows the query results based on the products’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the product by its ID in the elements_sites table #}
+{% set product = craft.products()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the product by its ID in the elements_sites table
+$product = \craft\commerce\elements\Product::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+ slug
+
+Narrows the query results based on the products’ slugs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a slug of `foo`.
+| `'foo*'` | with a slug that begins with `foo`.
+| `'*foo'` | with a slug that ends with `foo`.
+| `'*foo*'` | with a slug that contains `foo`.
+| `'not *foo*'` | with a slug that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a slug that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a slug that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested product slug from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the product with that slug #}
+{% set product = craft.products()
+ .slug(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested product slug from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the product with that slug
+$product = \craft\commerce\elements\Product::find()
+ ->slug(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+ status
+
+Narrows the query results based on the products’ statuses.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'live'` _(default)_ | that are live.
+| `'pending'` | that are pending (enabled with a Post Date in the future).
+| `'expired'` | that are expired (enabled with an Expiry Date in the past).
+| `'disabled'` | that are disabled.
+| `['live', 'pending']` | that are live or pending.
+
+
+
+::: code
+```twig
+{# Fetch disabled products #}
+{% set products = craft.products()
+ .status('disabled')
+ .all() %}
+```
+
+```php
+// Fetch disabled products
+$products = \craft\commerce\elements\Product::find()
+ ->status('disabled')
+ ->all();
+```
+:::
+
+
+ taxCategory
+
+Narrows the query results based on the products’ tax category.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | of a tax category with a handle of `foo`.
+| `'not foo'` | not of a tax category with a handle of `foo`.
+| `['foo', 'bar']` | of a tax category with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a tax category with a handle of `foo` or `bar`.
+| an [ShippingCategory](commerce4:craft\commerce\models\ShippingCategory) object | of a tax category represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products with a Foo tax category #}
+{% set products = craft.products()
+ .taxCategory('foo')
+ .all() %}
+```
+
+```php
+// Fetch products with a Foo tax category
+$products = \craft\commerce\elements\Product::find()
+ ->taxCategory('foo')
+ ->all();
+```
+:::
+
+
+ taxCategoryId
+
+Narrows the query results based on the products’ tax categories, per the tax categories’ IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a tax category with an ID of 1.
+| `'not 1'` | not of a tax category with an ID of 1.
+| `[1, 2]` | of a tax category with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a tax category with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch products of the tax category with an ID of 1 #}
+{% set products = craft.products()
+ .taxCategoryId(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the tax category with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->taxCategoryId(1)
+ ->all();
+```
+:::
+
+
+ title
+
+Narrows the query results based on the products’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch products with a title that contains "Foo" #}
+{% set products = craft.products()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch products with a title that contains "Foo"
+$products = \craft\commerce\elements\Product::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+ trashed
+
+Narrows the query results to only products that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed products #}
+{% set products = craft.products()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed products
+$products = \craft\commerce\elements\Product::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+ type
+
+Narrows the query results based on the products’ types.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | of a type with a handle of `foo`.
+| `'not foo'` | not of a type with a handle of `foo`.
+| `['foo', 'bar']` | of a type with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not of a type with a handle of `foo` or `bar`.
+| an [ProductType](commerce4:craft\commerce\models\ProductType) object | of a type represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch products with a Foo product type #}
+{% set products = craft.products()
+ .type('foo')
+ .all() %}
+```
+
+```php
+// Fetch products with a Foo product type
+$products = \craft\commerce\elements\Product::find()
+ ->type('foo')
+ ->all();
+```
+:::
+
+
+ typeId
+
+Narrows the query results based on the products’ types, per the types’ IDs.
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `1` | of a type with an ID of 1.
+| `'not 1'` | not of a type with an ID of 1.
+| `[1, 2]` | of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | not of a type with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch products of the product type with an ID of 1 #}
+{% set products = craft.products()
+ .typeId(1)
+ .all() %}
+```
+
+```php
+// Fetch products of the product type with an ID of 1
+$products = \craft\commerce\elements\Product::find()
+ ->typeId(1)
+ ->all();
+```
+:::
+
+
+ uid
+
+Narrows the query results based on the products’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the product by its UID #}
+{% set product = craft.products()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the product by its UID
+$product = \craft\commerce\elements\Product::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+ unique
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique products across all sites #}
+{% set products = craft.products()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique products across all sites
+$products = \craft\commerce\elements\Product::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+ uri
+
+Narrows the query results based on the products’ URIs.
+
+
+
+Possible values include:
+
+| Value | Fetches products…
+| - | -
+| `'foo'` | with a URI of `foo`.
+| `'foo*'` | with a URI that begins with `foo`.
+| `'*foo'` | with a URI that ends with `foo`.
+| `'*foo*'` | with a URI that contains `foo`.
+| `'not *foo*'` | with a URI that doesn’t contain `foo`.
+| `['*foo*', '*bar*']` | with a URI that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a URI that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested URI #}
+{% set requestedUri = craft.app.request.getPathInfo() %}
+
+{# Fetch the product with that URI #}
+{% set product = craft.products()
+ .uri(requestedUri|literal)
+ .one() %}
+```
+
+```php
+// Get the requested URI
+$requestedUri = \Craft::$app->request->getPathInfo();
+
+// Fetch the product with that URI
+$product = \craft\commerce\elements\Product::find()
+ ->uri(\craft\helpers\Db::escapeParam($requestedUri))
+ ->one();
+```
+:::
+
+
+ with
+
+Causes the query to return matching products eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch products eager-loaded with the "Related" field’s relations #}
+{% set products = craft.products()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch products eager-loaded with the "Related" field’s relations
+$products = \craft\commerce\elements\Product::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
+
+## Variants
+
+A variant describes the individual properties of a product as an item that may be purchased.
+
+Those properties inclue a SKU, price, and dimensions. Even if a product doesn’t appear to have any variants in the control panel, it still uses one *default variant* behind the scenes.
+
+Let’s compare examples of a single-variant an multi-variant product: a paperback book and a t-shirt.
+
+A book sold in only one format does not have meaningful variations for the customer to choose, but it would still have a specific SKU, price, weight, and dimensions. A single, implicit default variant needs to exist and that’s what would be added to the cart.
+
+A t-shirt, on the other hand, would have at least one variant for each available color and size combination. You wouldn’t sell the t-shirt without a specific color and size, so multiple variants would be necessary. If the shirt came in “small” and “large” sizes and “red” or “blue” colors, four unique variants could exist:
+
+- small, red
+- small, blue
+- large, red
+- large, blue
+
+### Variant Properties
+
+Each variant includes the following unique properties:
+
+| Property | Type | Required? |
+| ------------- | ------------------- | -------------- |
+| SKU | string | |
+| Price | number | |
+| Stock | number or unlimited | |
+| Allowed Qty | range | |
+| Dimensions | number (l × w × h) | |
+| Weight | number | |
+| Related Sales | relationship (Sale) | |
+
+Each variant may also have any number of custom fields to allow other distinguishing traits.
+
+Commerce does not automatically create every possible unique variant for you—that’s up to the store manager.
+
+### Default Variant
+
+Every product has a default variant. Whenever a product is created, a default variant will be created as well.
+
+If a product type has multiple variants enabled, the author can choose which one should be used by default. Products that do not have multiple variants still have a default variant, but the author can’t add additional variants.
+
+For a single-variant product, variant details are shown in a unified view with custom product fields:
+
+![Stylized illustration of a single-variant product edit page, with custom product fields in a single content pane and fields like SKU in the sidebar details](./images/single-variant.png)
+
+When a product supports multiple variants, the default variant will be identified in a **Variants** field where more variants can be added:
+
+![Stylized illustration of a multi-variant product edit page, with an additional “Variants” tab that has a Matrix-like editor for multiple variants each having their own fields like SKU](./images/multi-variant.png)
+
+### Variant Stock
+
+Variants can have unlimited stock or a specific quantity.
+
+A finite stock amount will automatically be reduced whenever someone completes an order, until the stock amount reaches zero. At that point the variant’s “Available for purchase” setting won’t be changed, but zero-stock variants cannot be added to a cart.
+
+For returns or refunds that aren’t ultimately delivered to the customer, you’ll need to either manually update product stock or use [the `orderStatusChange` event](extend/events.md#orderstatuschange) to automate further stock adjustments.
+
+## Querying Variants
+
+You can fetch variants using **variant queries**.
+
+::: code
+```twig
+{# Create a new variant query #}
+{% set myVariantQuery = craft.variants() %}
+```
+```php
+// Create a new variant query
+$myVariantQuery = \craft\commerce\elements\Variant::find();
+```
+```graphql
+# Create a new variant query
+{
+ variants {
+ # ...
+ }
+}
+```
+:::
+
+Once you’ve created a variant query, you can set [parameters](#variant-query-parameters) on it to narrow down the results, and then [execute it](https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries) by calling `.all()`. An array of [Variant](commerce4:craft\commerce\elements\Variant) objects will be returned.
+
+You can also fetch only the number of items a query might return, which is better for performance when you don’t need the variant data.
+
+::: code
+```twig
+{# Count all enabled variants #}
+{% set myVariantCount = craft.variants()
+ .status('enabled')
+ .count() %}
+```
+```php
+use craft\commerce\elements\Variant;
+
+// Count all enabled variants
+$myVariantCount = Variant::find()
+ ->status(Variant::STATUS_ENABLED)
+ ->count();
+```
+```graphql
+# Count all enabled variants
+{
+ variantCount(status: "enabled")
+}
+```
+:::
+
+::: tip
+See [Element Queries](https://craftcms.com/docs/4.x/element-queries.html) in the Craft docs to learn about how element queries work.
+:::
+
+### Example
+
+We can display a specific variant by its ID in Twig by doing the following:
+
+1. Create a variant query with `craft.variants()`.
+2. Set the [`id`](#id) parameter on it.
+3. Fetch the variant with `.one()`.
+4. Output information about the variant as HTML.
+
+```twig
+{# Get the requested variant ID from the query string #}
+{% set variantId = craft.app.request.getQueryParam('id') %}
+
+{# Create a variant query with the 'id' parameter #}
+{% set myVariantQuery = craft.variants()
+ .id(variantId) %}
+
+{# Fetch the variant #}
+{% set variant = myVariantQuery.one() %}
+
+{# Make sure it exists #}
+{% if not variant %}
+ {% exit 404 %}
+{% endif %}
+
+{# Display the variant #}
+{{ variant.title }}
+
+```
+
+Fetching the equivalent with GraphQL could look like this:
+
+```graphql
+# Fetch variant having ID = 46
+{
+ variants(id: 46) {
+ title
+ }
+}
+```
+
+## Variant Query Parameters
+
+Variant queries support the following parameters:
+
+
+
+
+
+
+
+| Param | Description
+| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#variant-afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#variant-andrelatedto) | Narrows the query results to only variants that are related to certain other elements.
+| [asArray](#variant-asarray) | Causes the query to return matching variants as arrays of data, rather than [Variant](commerce4:craft\commerce\elements\Variant) objects.
+| [cache](#variant-cache) | Enables query cache for this Query.
+| [clearCachedResult](#variant-clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [dateCreated](#variant-datecreated) | Narrows the query results based on the variants’ creation dates.
+| [dateUpdated](#variant-dateupdated) | Narrows the query results based on the variants’ last-updated dates.
+| [fixedOrder](#variant-fixedorder) | Causes the query results to be returned in the order specified by [id](#variant-id).
+| [hasProduct](#variant-hasproduct) | Narrows the query results to only variants for certain products.
+| [hasSales](#variant-hassales) | Narrows the query results to only variants that are on sale.
+| [hasStock](#variant-hasstock) | Narrows the query results to only variants that have stock.
+| [hasUnlimitedStock](#variant-hasunlimitedstock) | Narrows the query results to only variants that have been set to unlimited stock.
+| [height](#variant-height) | Narrows the query results based on the variants’ height dimension.
+| [id](#variant-id) | Narrows the query results based on the variants’ IDs.
+| [ignorePlaceholders](#variant-ignoreplaceholders) | Causes the query to return matching variants as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#variant-inreverse) | Causes the query results to be returned in reverse order.
+| [isDefault](#variant-isdefault) | Narrows the query results to only default variants.
+| [length](#variant-length) | Narrows the query results based on the variants’ length dimension.
+| [limit](#variant-limit) | Determines the number of variants that should be returned.
+| [maxQty](#variant-maxqty) | Narrows the query results based on the variants’ max quantity.
+| [minQty](#variant-minqty) | Narrows the query results based on the variants’ min quantity.
+| [offset](#variant-offset) | Determines how many variants should be skipped in the results.
+| [orderBy](#variant-orderby) | Determines the order that the variants should be returned in. (If empty, defaults to `sortOrder ASC`.)
+| [preferSites](#variant-prefersites) | If [unique](#variant-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#variant-preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [price](#variant-price) | Narrows the query results based on the variants’ price.
+| [product](#variant-product) | Narrows the query results based on the variants’ product.
+| [productId](#variant-productid) | Narrows the query results based on the variants’ products’ IDs.
+| [relatedTo](#variant-relatedto) | Narrows the query results to only variants that are related to certain other elements.
+| [search](#variant-search) | Narrows the query results to only variants that match a search query.
+| [site](#variant-site) | Determines which site(s) the variants should be queried in.
+| [siteId](#variant-siteid) |
+| [siteSettingsId](#variant-sitesettingsid) | Narrows the query results based on the variants’ IDs in the `elements_sites` table.
+| [sku](#variant-sku) | Narrows the query results based on the variants’ SKUs.
+| [status](#variant-status) |
+| [stock](#variant-stock) | Narrows the query results based on the variants’ stock.
+| [title](#variant-title) | Narrows the query results based on the variants’ titles.
+| [trashed](#variant-trashed) | Narrows the query results to only variants that have been soft-deleted.
+| [typeId](#variant-typeid) | Narrows the query results based on the variants’ product types, per their IDs.
+| [uid](#variant-uid) | Narrows the query results based on the variants’ UIDs.
+| [unique](#variant-unique) | Determines whether only elements with unique IDs should be returned by the query.
+| [weight](#variant-weight) | Narrows the query results based on the variants’ weight dimension.
+| [width](#variant-width) | Narrows the query results based on the variants’ width dimension.
+| [with](#variant-with) | Causes the query to return matching variants eager-loaded with related elements.
+
+
+
+
+
+ afterPopulate
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+
+
+Narrows the query results to only variants that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all variants that are related to myCategoryA and myCategoryB #}
+{% set variants = craft.variants()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all variants that are related to $myCategoryA and $myCategoryB
+$variants = \craft\commerce\elements\Variant::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+ asArray
+
+Causes the query to return matching variants as arrays of data, rather than [Variant](commerce4:craft\commerce\elements\Variant) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants as arrays #}
+{% set variants = craft.variants()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch variants as arrays
+$variants = \craft\commerce\elements\Variant::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+ cache
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+ clearCachedResult
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+ dateCreated
+
+Narrows the query results based on the variants’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch variants created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set variants = craft.variants()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch variants created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+ dateUpdated
+
+Narrows the query results based on the variants’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch variants updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set variants = craft.variants()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch variants updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$variants = \craft\commerce\elements\Variant::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+ fixedOrder
+
+Causes the query results to be returned in the order specified by [id](#variant-id).
+
+
+
+::: tip
+If no IDs were passed to [id](#variant-id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch variants in a specific order #}
+{% set variants = craft.variants()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch variants in a specific order
+$variants = \craft\commerce\elements\Variant::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+ hasProduct
+
+Narrows the query results to only variants for certain products.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [ProductQuery](commerce4:craft\commerce\elements\db\ProductQuery) object | for products that match the query.
+
+
+
+
+ hasSales
+
+Narrows the query results to only variants that are on sale.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | on sale
+| `false` | not on sale
+
+
+
+
+ hasStock
+
+Narrows the query results to only variants that have stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | with stock.
+| `false` | with no stock.
+
+
+
+
+ hasUnlimitedStock
+
+Narrows the query results to only variants that have been set to unlimited stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `true` | with unlimited stock checked.
+| `false` | with unlimited stock not checked.
+
+
+
+
+ height
+
+Narrows the query results based on the variants’ height dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a height of 100.
+| `'>= 100'` | with a height of at least 100.
+| `'< 100'` | with a height of less than 100.
+
+
+
+
+ id
+
+Narrows the query results based on the variants’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the variant by its ID #}
+{% set variant = craft.variants()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the variant by its ID
+$variant = \craft\commerce\elements\Variant::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#variant-fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+ ignorePlaceholders
+
+Causes the query to return matching variants as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+ inReverse
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch variants in reverse #}
+{% set variants = craft.variants()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch variants in reverse
+$variants = \craft\commerce\elements\Variant::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+ isDefault
+
+Narrows the query results to only default variants.
+
+
+
+::: code
+```twig
+{# Fetch default variants #}
+{% set variants = craft.variants()
+ .isDefault()
+ .all() %}
+```
+
+```php
+// Fetch default variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->isDefault()
+ ->all();
+```
+:::
+
+
+ length
+
+Narrows the query results based on the variants’ length dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a length of 100.
+| `'>= 100'` | with a length of at least 100.
+| `'< 100'` | with a length of less than 100.
+
+
+
+
+ limit
+
+Determines the number of variants that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 variants #}
+{% set variants = craft.variants()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+ maxQty
+
+Narrows the query results based on the variants’ max quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a maxQty of 100.
+| `'>= 100'` | with a maxQty of at least 100.
+| `'< 100'` | with a maxQty of less than 100.
+
+
+
+
+ minQty
+
+Narrows the query results based on the variants’ min quantity.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a minQty of 100.
+| `'>= 100'` | with a minQty of at least 100.
+| `'< 100'` | with a minQty of less than 100.
+
+
+
+
+ offset
+
+Determines how many variants should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all variants except for the first 3 #}
+{% set variants = craft.variants()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all variants except for the first 3
+$variants = \craft\commerce\elements\Variant::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+ orderBy
+
+Determines the order that the variants should be returned in. (If empty, defaults to `sortOrder ASC`.)
+
+
+
+::: code
+```twig
+{# Fetch all variants in order of date created #}
+{% set variants = craft.variants()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all variants in order of date created
+$variants = \craft\commerce\elements\Variant::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+ preferSites
+
+If [unique](#variant-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique variants from Site A, or Site B if they don’t exist in Site A #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique variants from Site A, or Site B if they don’t exist in Site A
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+ prepareSubquery
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+ price
+
+Narrows the query results based on the variants’ price.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a price of 100.
+| `'>= 100'` | with a price of at least 100.
+| `'< 100'` | with a price of less than 100.
+
+
+
+
+ product
+
+Narrows the query results based on the variants’ product.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| a [Product](commerce4:craft\commerce\elements\Product) object | for a product represented by the object.
+
+
+
+
+ productId
+
+Narrows the query results based on the variants’ products’ IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product with an ID of 1.
+| `[1, 2]` | for product with an ID of 1 or 2.
+| `['not', 1, 2]` | for product not with an ID of 1 or 2.
+
+
+
+
+
+
+Narrows the query results to only variants that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all variants that are related to myCategory #}
+{% set variants = craft.variants()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all variants that are related to $myCategory
+$variants = \craft\commerce\elements\Variant::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+ search
+
+Narrows the query results to only variants that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all variants that match the search query #}
+{% set variants = craft.variants()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all variants that match the search query
+$variants = \craft\commerce\elements\Variant::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+ site
+
+Determines which site(s) the variants should be queried in.
+
+
+
+The current site will be used by default.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | from the site with a handle of `foo`.
+| `['foo', 'bar']` | from a site with a handle of `foo` or `bar`.
+| `['not', 'foo', 'bar']` | not in a site with a handle of `foo` or `bar`.
+| a [craft\models\Site](https://docs.craftcms.com/api/v4/craft-models-site.html) object | from the site represented by the object.
+| `'*'` | from any site.
+
+::: tip
+If multiple sites are specified, elements that belong to multiple sites will be returned multiple times. If you
+only want unique elements to be returned, use [unique](#variant-unique) in conjunction with this.
+:::
+
+
+
+::: code
+```twig
+{# Fetch variants from the Foo site #}
+{% set variants = craft.variants()
+ .site('foo')
+ .all() %}
+```
+
+```php
+// Fetch variants from the Foo site
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('foo')
+ ->all();
+```
+:::
+
+
+ siteId
+
+
+
+
+
+
+
+
+ siteSettingsId
+
+Narrows the query results based on the variants’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the variant by its ID in the elements_sites table #}
+{% set variant = craft.variants()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the variant by its ID in the elements_sites table
+$variant = \craft\commerce\elements\Variant::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+ sku
+
+Narrows the query results based on the variants’ SKUs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'foo'` | with a SKU of `foo`.
+| `'foo*'` | with a SKU that begins with `foo`.
+| `'*foo'` | with a SKU that ends with `foo`.
+| `'*foo*'` | with a SKU that contains `foo`.
+| `'not *foo*'` | with a SKU that doesn’t contain `foo`.
+| `['*foo*', '*bar*'` | with a SKU that contains `foo` or `bar`.
+| `['not', '*foo*', '*bar*']` | with a SKU that doesn’t contain `foo` or `bar`.
+
+
+
+::: code
+```twig
+{# Get the requested variant SKU from the URL #}
+{% set requestedSlug = craft.app.request.getSegment(3) %}
+
+{# Fetch the variant with that slug #}
+{% set variant = craft.variants()
+ .sku(requestedSlug|literal)
+ .one() %}
+```
+
+```php
+// Get the requested variant SKU from the URL
+$requestedSlug = \Craft::$app->request->getSegment(3);
+
+// Fetch the variant with that slug
+$variant = \craft\commerce\elements\Variant::find()
+ ->sku(\craft\helpers\Db::escapeParam($requestedSlug))
+ ->one();
+```
+:::
+
+
+ status
+
+
+
+
+
+
+
+
+ stock
+
+Narrows the query results based on the variants’ stock.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `0` | with no stock.
+| `'>= 5'` | with a stock of at least 5.
+| `'< 10'` | with a stock of less than 10.
+
+
+
+
+ title
+
+Narrows the query results based on the variants’ titles.
+
+
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `'Foo'` | with a title of `Foo`.
+| `'Foo*'` | with a title that begins with `Foo`.
+| `'*Foo'` | with a title that ends with `Foo`.
+| `'*Foo*'` | with a title that contains `Foo`.
+| `'not *Foo*'` | with a title that doesn’t contain `Foo`.
+| `['*Foo*', '*Bar*']` | with a title that contains `Foo` or `Bar`.
+| `['not', '*Foo*', '*Bar*']` | with a title that doesn’t contain `Foo` or `Bar`.
+
+
+
+::: code
+```twig
+{# Fetch variants with a title that contains "Foo" #}
+{% set variants = craft.variants()
+ .title('*Foo*')
+ .all() %}
+```
+
+```php
+// Fetch variants with a title that contains "Foo"
+$variants = \craft\commerce\elements\Variant::find()
+ ->title('*Foo*')
+ ->all();
+```
+:::
+
+
+ trashed
+
+Narrows the query results to only variants that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed variants #}
+{% set variants = craft.variants()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed variants
+$variants = \craft\commerce\elements\Variant::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+ typeId
+
+Narrows the query results based on the variants’ product types, per their IDs.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `1` | for a product of a type with an ID of 1.
+| `[1, 2]` | for product of a type with an ID of 1 or 2.
+| `['not', 1, 2]` | for product of a type not with an ID of 1 or 2.
+
+
+
+
+ uid
+
+Narrows the query results based on the variants’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the variant by its UID #}
+{% set variant = craft.variants()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the variant by its UID
+$variant = \craft\commerce\elements\Variant::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+ unique
+
+Determines whether only elements with unique IDs should be returned by the query.
+
+
+
+This should be used when querying elements from multiple sites at the same time, if “duplicate” results is not
+desired.
+
+
+
+::: code
+```twig
+{# Fetch unique variants across all sites #}
+{% set variants = craft.variants()
+ .site('*')
+ .unique()
+ .all() %}
+```
+
+```php
+// Fetch unique variants across all sites
+$variants = \craft\commerce\elements\Variant::find()
+ ->site('*')
+ ->unique()
+ ->all();
+```
+:::
+
+
+ weight
+
+Narrows the query results based on the variants’ weight dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a weight of 100.
+| `'>= 100'` | with a weight of at least 100.
+| `'< 100'` | with a weight of less than 100.
+
+
+
+
+ width
+
+Narrows the query results based on the variants’ width dimension.
+
+Possible values include:
+
+| Value | Fetches variants…
+| - | -
+| `100` | with a width of 100.
+| `'>= 100'` | with a width of at least 100.
+| `'< 100'` | with a width of less than 100.
+
+
+
+
+ with
+
+Causes the query to return matching variants eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch variants eager-loaded with the "Related" field’s relations #}
+{% set variants = craft.variants()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch variants eager-loaded with the "Related" field’s relations
+$variants = \craft\commerce\elements\Variant::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/commerce/4.x/subscriptions.md b/docs/.artifacts/commerce/4.x/subscriptions.md
new file mode 100644
index 000000000..a3c9d3430
--- /dev/null
+++ b/docs/.artifacts/commerce/4.x/subscriptions.md
@@ -0,0 +1,1062 @@
+
+
+
+
+
+
+
+
+| Param | Description
+| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+| [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
+| [andRelatedTo](#andrelatedto) | Narrows the query results to only subscriptions that are related to certain other elements.
+| [asArray](#asarray) | Causes the query to return matching subscriptions as arrays of data, rather than [Subscription](commerce4:craft\commerce\elements\Subscription) objects.
+| [cache](#cache) | Enables query cache for this Query.
+| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+| [dateCanceled](#datecanceled) | Narrows the query results based on the subscriptions’ cancellation date.
+| [dateCreated](#datecreated) | Narrows the query results based on the subscriptions’ creation dates.
+| [dateExpired](#dateexpired) | Narrows the query results based on the subscriptions’ expiration date.
+| [dateSuspended](#datesuspended) | Narrows the query results based on the subscriptions’ suspension date.
+| [dateUpdated](#dateupdated) | Narrows the query results based on the subscriptions’ last-updated dates.
+| [fixedOrder](#fixedorder) | Causes the query results to be returned in the order specified by [id](#id).
+| [gatewayId](#gatewayid) | Narrows the query results based on the gateway, per its ID.
+| [hasStarted](#hasstarted) | Narrows the query results to only subscriptions that have started.
+| [id](#id) | Narrows the query results based on the subscriptions’ IDs.
+| [ignorePlaceholders](#ignoreplaceholders) | Causes the query to return matching subscriptions as they are stored in the database, ignoring matching placeholder elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+| [inReverse](#inreverse) | Causes the query results to be returned in reverse order.
+| [isCanceled](#iscanceled) | Narrows the query results to only subscriptions that are canceled.
+| [isExpired](#isexpired) | Narrows the query results to only subscriptions that have expired.
+| [isSuspended](#issuspended) | Narrows the query results to only subscriptions that are suspended.
+| [limit](#limit) | Determines the number of subscriptions that should be returned.
+| [nextPaymentDate](#nextpaymentdate) | Narrows the query results based on the subscriptions’ next payment dates.
+| [offset](#offset) | Determines how many subscriptions should be skipped in the results.
+| [onTrial](#ontrial) | Narrows the query results to only subscriptions that are on trial.
+| [orderBy](#orderby) | Determines the order that the subscriptions should be returned in. (If empty, defaults to `dateCreated DESC`.)
+| [orderId](#orderid) | Narrows the query results based on the order, per its ID.
+| [plan](#plan) | Narrows the query results based on the subscription plan.
+| [planId](#planid) | Narrows the query results based on the subscription plans’ IDs.
+| [preferSites](#prefersites) | If [unique()](https://docs.craftcms.com/api/v4/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+| [prepareSubquery](#preparesubquery) | Prepares the element query and returns its subquery (which determines what elements will be returned).
+| [reference](#reference) | Narrows the query results based on the reference.
+| [relatedTo](#relatedto) | Narrows the query results to only subscriptions that are related to certain other elements.
+| [search](#search) | Narrows the query results to only subscriptions that match a search query.
+| [siteSettingsId](#sitesettingsid) | Narrows the query results based on the subscriptions’ IDs in the `elements_sites` table.
+| [status](#status) | Narrows the query results based on the subscriptions’ statuses.
+| [trashed](#trashed) | Narrows the query results to only subscriptions that have been soft-deleted.
+| [trialDays](#trialdays) | Narrows the query results based on the number of trial days.
+| [uid](#uid) | Narrows the query results based on the subscriptions’ UIDs.
+| [user](#user) | Narrows the query results based on the subscriptions’ user accounts.
+| [userId](#userid) | Narrows the query results based on the subscriptions’ user accounts’ IDs.
+| [with](#with) | Causes the query to return matching subscriptions eager-loaded with related elements.
+
+
+
+
+
+#### `afterPopulate`
+
+Performs any post-population processing on elements.
+
+
+
+
+
+
+
+
+
+
+#### `andRelatedTo`
+
+Narrows the query results to only subscriptions that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions that are related to myCategoryA and myCategoryB #}
+{% set subscriptions = craft.subscriptions()
+ .relatedTo(myCategoryA)
+ .andRelatedTo(myCategoryB)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions that are related to $myCategoryA and $myCategoryB
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->relatedTo($myCategoryA)
+ ->andRelatedTo($myCategoryB)
+ ->all();
+```
+:::
+
+
+#### `asArray`
+
+Causes the query to return matching subscriptions as arrays of data, rather than [Subscription](commerce4:craft\commerce\elements\Subscription) objects.
+
+
+
+
+
+::: code
+```twig
+{# Fetch subscriptions as arrays #}
+{% set subscriptions = craft.subscriptions()
+ .asArray()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions as arrays
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->asArray()
+ ->all();
+```
+:::
+
+
+#### `cache`
+
+Enables query cache for this Query.
+
+
+
+
+
+
+
+
+
+
+#### `clearCachedResult`
+
+Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache).
+
+
+
+
+
+
+#### `dateCanceled`
+
+Narrows the query results based on the subscriptions’ cancellation date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were canceled on or after 2018-04-01.
+| `'< 2018-05-01'` | that were canceled before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were canceled between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions that were canceled recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateCanceled(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that were canceled recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateCanceled(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateCreated`
+
+Narrows the query results based on the subscriptions’ creation dates.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were created on or after 2018-04-01.
+| `'< 2018-05-01'` | that were created before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were created between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were created at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions created last month #}
+{% set start = date('first day of last month')|atom %}
+{% set end = date('first day of this month')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateCreated(['and', ">= #{start}", "< #{end}"])
+ .all() %}
+```
+
+```php
+// Fetch subscriptions created last month
+$start = (new \DateTime('first day of last month'))->format(\DateTime::ATOM);
+$end = (new \DateTime('first day of this month'))->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateCreated(['and', ">= {$start}", "< {$end}"])
+ ->all();
+```
+:::
+
+
+#### `dateExpired`
+
+Narrows the query results based on the subscriptions’ expiration date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that expired on or after 2018-04-01.
+| `'< 2018-05-01'` | that expired before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that expired between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions that expired recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateExpired(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that expired recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateExpired(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateSuspended`
+
+Narrows the query results based on the subscriptions’ suspension date.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were suspended on or after 2018-04-01.
+| `'< 2018-05-01'` | that were suspended before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were suspended between 2018-04-01 and 2018-05-01.
+
+
+::: code
+```twig
+{# Fetch subscriptions that were suspended recently #}
+{% set aWeekAgo = date('7 days ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateSuspended(">= #{aWeekAgo}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions that were suspended recently
+$aWeekAgo = new \DateTime('7 days ago')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateSuspended(">= {$aWeekAgo}")
+ ->all();
+```
+:::
+
+
+#### `dateUpdated`
+
+Narrows the query results based on the subscriptions’ last-updated dates.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | that were updated on or after 2018-04-01.
+| `'< 2018-05-01'` | that were updated before 2018-05-01.
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | that were updated between 2018-04-01 and 2018-05-01.
+| `now`/`today`/`tomorrow`/`yesterday` | that were updated at midnight of the specified relative date.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions updated in the last week #}
+{% set lastWeek = date('1 week ago')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .dateUpdated(">= #{lastWeek}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions updated in the last week
+$lastWeek = (new \DateTime('1 week ago'))->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->dateUpdated(">= {$lastWeek}")
+ ->all();
+```
+:::
+
+
+#### `fixedOrder`
+
+Causes the query results to be returned in the order specified by [id](#id).
+
+
+
+::: tip
+If no IDs were passed to [id](#id), setting this to `true` will result in an empty result set.
+:::
+
+
+
+::: code
+```twig
+{# Fetch subscriptions in a specific order #}
+{% set subscriptions = craft.subscriptions()
+ .id([1, 2, 3, 4, 5])
+ .fixedOrder()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions in a specific order
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->id([1, 2, 3, 4, 5])
+ ->fixedOrder()
+ ->all();
+```
+:::
+
+
+#### `gatewayId`
+
+Narrows the query results based on the gateway, per its ID.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with a gateway with an ID of 1.
+| `'not 1'` | not with a gateway with an ID of 1.
+| `[1, 2]` | with a gateway with an ID of 1 or 2.
+| `['not', 1, 2]` | not with a gateway with an ID of 1 or 2.
+
+
+
+
+#### `hasStarted`
+
+Narrows the query results to only subscriptions that have started.
+
+
+
+::: code
+```twig
+{# Fetch started subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .hasStarted()
+ .all() %}
+```
+
+```php
+// Fetch started subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->hasStarted()
+ ->all();
+```
+:::
+
+
+#### `id`
+
+Narrows the query results based on the subscriptions’ IDs.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an ID of 1.
+| `'not 1'` | not with an ID of 1.
+| `[1, 2]` | with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its ID #}
+{% set subscription = craft.subscriptions()
+ .id(1)
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its ID
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->id(1)
+ ->one();
+```
+:::
+
+
+
+::: tip
+This can be combined with [fixedOrder](#fixedorder) if you want the results to be returned in a specific order.
+:::
+
+
+#### `ignorePlaceholders`
+
+Causes the query to return matching subscriptions as they are stored in the database, ignoring matching placeholder
+elements that were set by [craft\services\Elements::setPlaceholderElement()](https://docs.craftcms.com/api/v4/craft-services-elements.html#method-setplaceholderelement).
+
+
+
+
+
+
+
+
+
+
+#### `inReverse`
+
+Causes the query results to be returned in reverse order.
+
+
+
+
+
+::: code
+```twig
+{# Fetch subscriptions in reverse #}
+{% set subscriptions = craft.subscriptions()
+ .inReverse()
+ .all() %}
+```
+
+```php
+// Fetch subscriptions in reverse
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->inReverse()
+ ->all();
+```
+:::
+
+
+#### `isCanceled`
+
+Narrows the query results to only subscriptions that are canceled.
+
+
+
+::: code
+```twig
+{# Fetch canceled subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isCanceled()
+ .all() %}
+```
+
+```php
+// Fetch canceled subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isCanceled()
+ ->all();
+```
+:::
+
+
+#### `isExpired`
+
+Narrows the query results to only subscriptions that have expired.
+
+
+
+::: code
+```twig
+{# Fetch expired subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isExpired()
+ .all() %}
+```
+
+```php
+// Fetch expired subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isExpired()
+ ->all();
+```
+:::
+
+
+#### `isSuspended`
+
+Narrows the query results to only subscriptions that are suspended.
+
+
+
+::: code
+```twig
+{# Fetch suspended subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .isSuspended()
+ .all() %}
+```
+
+```php
+// Fetch suspended subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isSuspended()
+ ->all();
+```
+:::
+
+
+#### `limit`
+
+Determines the number of subscriptions that should be returned.
+
+
+
+::: code
+```twig
+{# Fetch up to 10 subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .limit(10)
+ .all() %}
+```
+
+```php
+// Fetch up to 10 subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->limit(10)
+ ->all();
+```
+:::
+
+
+#### `nextPaymentDate`
+
+Narrows the query results based on the subscriptions’ next payment dates.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'>= 2018-04-01'` | with a next payment on or after 2018-04-01.
+| `'< 2018-05-01'` | with a next payment before 2018-05-01
+| `['and', '>= 2018-04-04', '< 2018-05-01']` | with a next payment between 2018-04-01 and 2018-05-01.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions with a payment due soon #}
+{% set aWeekFromNow = date('+7 days')|atom %}
+
+{% set subscriptions = craft.subscriptions()
+ .nextPaymentDate("< #{aWeekFromNow}")
+ .all() %}
+```
+
+```php
+// Fetch subscriptions with a payment due soon
+$aWeekFromNow = new \DateTime('+7 days')->format(\DateTime::ATOM);
+
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->nextPaymentDate("< {$aWeekFromNow}")
+ ->all();
+```
+:::
+
+
+#### `offset`
+
+Determines how many subscriptions should be skipped in the results.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions except for the first 3 #}
+{% set subscriptions = craft.subscriptions()
+ .offset(3)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions except for the first 3
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->offset(3)
+ ->all();
+```
+:::
+
+
+#### `onTrial`
+
+Narrows the query results to only subscriptions that are on trial.
+
+
+
+::: code
+```twig
+{# Fetch trialed subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .onTrial()
+ .all() %}
+```
+
+```php
+// Fetch trialed subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->isPaid()
+ ->all();
+```
+:::
+
+
+#### `orderBy`
+
+Determines the order that the subscriptions should be returned in. (If empty, defaults to `dateCreated DESC`.)
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions in order of date created #}
+{% set subscriptions = craft.subscriptions()
+ .orderBy('dateCreated ASC')
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions in order of date created
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->orderBy('dateCreated ASC')
+ ->all();
+```
+:::
+
+
+#### `orderId`
+
+Narrows the query results based on the order, per its ID.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an order with an ID of 1.
+| `'not 1'` | not with an order with an ID of 1.
+| `[1, 2]` | with an order with an ID of 1 or 2.
+| `['not', 1, 2]` | not with an order with an ID of 1 or 2.
+
+
+
+
+#### `plan`
+
+Narrows the query results based on the subscription plan.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'foo'` | for a plan with a handle of `foo`.
+| `['foo', 'bar']` | for plans with a handle of `foo` or `bar`.
+| a [Plan](commerce4:craft\commerce\base\Plan) object | for a plan represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch Supporter plan subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .plan('supporter')
+ .all() %}
+```
+
+```php
+// Fetch Supporter plan subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->plan('supporter')
+ ->all();
+```
+:::
+
+
+#### `planId`
+
+Narrows the query results based on the subscription plans’ IDs.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | for a plan with an ID of 1.
+| `[1, 2]` | for plans with an ID of 1 or 2.
+| `['not', 1, 2]` | for plans not with an ID of 1 or 2.
+
+
+
+
+#### `preferSites`
+
+If [unique()](https://docs.craftcms.com/api/v4/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
+
+
+
+For example, if element “Foo” exists in Site A and Site B, and element “Bar” exists in Site B and Site C,
+and this is set to `['c', 'b', 'a']`, then Foo will be returned for Site B, and Bar will be returned
+for Site C.
+
+If this isn’t set, then preference goes to the current site.
+
+
+
+::: code
+```twig
+{# Fetch unique subscriptions from Site A, or Site B if they don’t exist in Site A #}
+{% set subscriptions = craft.subscriptions()
+ .site('*')
+ .unique()
+ .preferSites(['a', 'b'])
+ .all() %}
+```
+
+```php
+// Fetch unique subscriptions from Site A, or Site B if they don’t exist in Site A
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->site('*')
+ ->unique()
+ ->preferSites(['a', 'b'])
+ ->all();
+```
+:::
+
+
+#### `prepareSubquery`
+
+Prepares the element query and returns its subquery (which determines what elements will be returned).
+
+
+
+
+
+
+#### `reference`
+
+Narrows the query results based on the reference.
+
+
+
+
+
+
+#### `relatedTo`
+
+Narrows the query results to only subscriptions that are related to certain other elements.
+
+
+
+See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch all subscriptions that are related to myCategory #}
+{% set subscriptions = craft.subscriptions()
+ .relatedTo(myCategory)
+ .all() %}
+```
+
+```php
+// Fetch all subscriptions that are related to $myCategory
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->relatedTo($myCategory)
+ ->all();
+```
+:::
+
+
+#### `search`
+
+Narrows the query results to only subscriptions that match a search query.
+
+
+
+See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Get the search query from the 'q' query string param #}
+{% set searchQuery = craft.app.request.getQueryParam('q') %}
+
+{# Fetch all subscriptions that match the search query #}
+{% set subscriptions = craft.subscriptions()
+ .search(searchQuery)
+ .all() %}
+```
+
+```php
+// Get the search query from the 'q' query string param
+$searchQuery = \Craft::$app->request->getQueryParam('q');
+
+// Fetch all subscriptions that match the search query
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->search($searchQuery)
+ ->all();
+```
+:::
+
+
+#### `siteSettingsId`
+
+Narrows the query results based on the subscriptions’ IDs in the `elements_sites` table.
+
+
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | with an `elements_sites` ID of 1.
+| `'not 1'` | not with an `elements_sites` ID of 1.
+| `[1, 2]` | with an `elements_sites` ID of 1 or 2.
+| `['not', 1, 2]` | not with an `elements_sites` ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its ID in the elements_sites table #}
+{% set subscription = craft.subscriptions()
+ .siteSettingsId(1)
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its ID in the elements_sites table
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->siteSettingsId(1)
+ ->one();
+```
+:::
+
+
+#### `status`
+
+Narrows the query results based on the subscriptions’ statuses.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'active'` _(default)_ | that are active.
+| `'expired'` | that have expired.
+
+
+
+::: code
+```twig
+{# Fetch expired subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .status('expired')
+ .all() %}
+```
+
+```php
+// Fetch expired subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->status('expired')
+ ->all();
+```
+:::
+
+
+#### `trashed`
+
+Narrows the query results to only subscriptions that have been soft-deleted.
+
+
+
+
+
+::: code
+```twig
+{# Fetch trashed subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .trashed()
+ .all() %}
+```
+
+```php
+// Fetch trashed subscriptions
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->trashed()
+ ->all();
+```
+:::
+
+
+#### `trialDays`
+
+Narrows the query results based on the number of trial days.
+
+
+
+
+
+
+#### `uid`
+
+Narrows the query results based on the subscriptions’ UIDs.
+
+
+
+
+
+::: code
+```twig
+{# Fetch the subscription by its UID #}
+{% set subscription = craft.subscriptions()
+ .uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ .one() %}
+```
+
+```php
+// Fetch the subscription by its UID
+$subscription = \craft\commerce\elements\Subscription::find()
+ ->uid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
+ ->one();
+```
+:::
+
+
+#### `user`
+
+Narrows the query results based on the subscriptions’ user accounts.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `'foo'` | for a user account with a username of `foo`
+| `['foo', 'bar']` | for user accounts with a username of `foo` or `bar`.
+| a [User](https://docs.craftcms.com/api/v4/craft-elements-user.html) object | for a user account represented by the object.
+
+
+
+::: code
+```twig
+{# Fetch the current user's subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .user(currentUser)
+ .all() %}
+```
+
+```php
+// Fetch the current user's subscriptions
+$user = Craft::$app->user->getIdentity();
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->user($user)
+ ->all();
+```
+:::
+
+
+#### `userId`
+
+Narrows the query results based on the subscriptions’ user accounts’ IDs.
+
+Possible values include:
+
+| Value | Fetches subscriptions…
+| - | -
+| `1` | for a user account with an ID of 1.
+| `[1, 2]` | for user accounts with an ID of 1 or 2.
+| `['not', 1, 2]` | for user accounts not with an ID of 1 or 2.
+
+
+
+::: code
+```twig
+{# Fetch the current user's subscriptions #}
+{% set subscriptions = craft.subscriptions()
+ .userId(currentUser.id)
+ .all() %}
+```
+
+```php
+// Fetch the current user's subscriptions
+$user = Craft::$app->user->getIdentity();
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->userId($user->id)
+ ->all();
+```
+:::
+
+
+#### `with`
+
+Causes the query to return matching subscriptions eager-loaded with related elements.
+
+
+
+See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter.
+
+
+
+::: code
+```twig
+{# Fetch subscriptions eager-loaded with the "Related" field’s relations #}
+{% set subscriptions = craft.subscriptions()
+ .with(['related'])
+ .all() %}
+```
+
+```php
+// Fetch subscriptions eager-loaded with the "Related" field’s relations
+$subscriptions = \craft\commerce\elements\Subscription::find()
+ ->with(['related'])
+ ->all();
+```
+:::
+
+
+
+
diff --git a/docs/.artifacts/include-template.md b/docs/.artifacts/include-template.md
new file mode 100644
index 000000000..2c39bc685
--- /dev/null
+++ b/docs/.artifacts/include-template.md
@@ -0,0 +1 @@
+
diff --git a/docs/.vuepress/components/Since.vue b/docs/.vuepress/components/Since.vue
index f8d527b79..4fbaa0fea 100644
--- a/docs/.vuepress/components/Since.vue
+++ b/docs/.vuepress/components/Since.vue
@@ -2,7 +2,7 @@
{{ ver }}+
@@ -16,6 +16,10 @@ export default {
components: {},
props: {
ver: String,
+ product: {
+ type: String,
+ default: 'Craft',
+ },
useChangelog: {
type: Boolean,
default: true,
@@ -28,6 +32,10 @@ export default {
type: String,
default: 'This feature',
},
+ description: {
+ type: String,
+ default: '{feature} was first available in version {ver} of {product}.',
+ }
},
computed: {
releaseUrl() {
@@ -38,6 +46,12 @@ export default {
return `${GITHUB_URL}/${this.repo}/releases/tag/${this.ver}`;
},
+ parsedDescription() {
+ return this.description
+ .replace('{feature}', this.feature)
+ .replace('{ver}', this.ver)
+ .replace('{product}', this.product);
+ }
},
};
diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js
index 7b3e00160..596a4be31 100644
--- a/docs/.vuepress/config.js
+++ b/docs/.vuepress/config.js
@@ -65,8 +65,8 @@ module.exports = {
},
feedback: {
helpful: "Was this page helpful?",
- thanks: "Thanks for your feedback.",
- more: "Give More Feedback →"
+ thanks: "Thanks for your feedback!",
+ more: "Report an Issue →"
}
},
markdown: {
@@ -86,7 +86,8 @@ module.exports = {
md.use(require("./theme/util/replace-anchor-prefixes").replacePrefixes)
.use(require("./theme/markup"))
.use(require("markdown-it-deflist"))
- .use(require("markdown-it-imsize"));
+ .use(require("markdown-it-imsize"))
+ .use(require("markdown-it-include"));
}
},
postcss: {
diff --git a/docs/.vuepress/sets/craft-cms.js b/docs/.vuepress/sets/craft-cms.js
index ade8b2900..5797f1901 100644
--- a/docs/.vuepress/sets/craft-cms.js
+++ b/docs/.vuepress/sets/craft-cms.js
@@ -176,6 +176,7 @@ module.exports = {
"categories-fields",
"checkboxes-fields",
"color-fields",
+ "country-fields",
"date-time-fields",
"dropdown-fields",
"email-fields",
diff --git a/docs/.vuepress/theme/components/EventBrowser.vue b/docs/.vuepress/theme/components/EventBrowser.vue
index c9951c0bb..73a1812da 100644
--- a/docs/.vuepress/theme/components/EventBrowser.vue
+++ b/docs/.vuepress/theme/components/EventBrowser.vue
@@ -342,10 +342,10 @@
-
-
diff --git a/docs/.vuepress/theme/components/PageFooter.vue b/docs/.vuepress/theme/components/PageFooter.vue
index 0bd078c8c..caf4492d3 100644
--- a/docs/.vuepress/theme/components/PageFooter.vue
+++ b/docs/.vuepress/theme/components/PageFooter.vue
@@ -1,165 +1,105 @@