Skip to content

Commit fa3ba30

Browse files
authored
Merge pull request #654 from craftcms/commerce-5.1
Commerce 5.1
2 parents 00e449f + 7050b8b commit fa3ba30

22 files changed

+2879
-2721
lines changed

docs/.artifacts/commerce/5.x/product-query-params.md

Lines changed: 1430 additions & 0 deletions
Large diffs are not rendered by default.

docs/.artifacts/commerce/5.x/products-variants.md

Lines changed: 0 additions & 2619 deletions
Large diffs are not rendered by default.

docs/.artifacts/commerce/5.x/variant-query-params.md

Lines changed: 1035 additions & 0 deletions
Large diffs are not rendered by default.

docs/5.x/reference/twig/global-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Additional variables provided by Craft.
3636
Variable | Description
3737
--- | ---
3838
[_globals](#globals) | Get and set values on a globally-available store.
39-
[craft](#craft) | A <craft5:craft\web\twig\variables\CraftVariable> object.
39+
[craft](#craft-2) | A <craft5:craft\web\twig\variables\CraftVariable> object.
4040
[currentSite](#currentsite) | The requested site.
4141
[currentUser](#currentuser) | The currently logged-in user.
4242
[devMode](#devmode) | Whether Dev Mode is enabled.

docs/commerce/5.x/development/cart.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@ Craft includes a powerful [internationalization engine](guide:tutorial-i18n#plur
9393

9494
### Line Items
9595

96-
A cart’s contents are represented by _line items_. Line items are populated from [purchasables](../system/purchasables.md) when they are added to the cart (out-of-the-box, this will almost always be a [variant](../system/products-variants.md)), and have a quantity, description, notes, a calculated subtotal, options, adjustments (like tax and shipping costs), and other metadata. Most importantly, though, the line item retains a reference to its purchasable so that it can be refreshed with the latest information from your store while the customer is shopping.
96+
A cart’s contents are represented by _line items_. Line items are typically populated from [purchasables](../system/purchasables.md) when they are added to the cart, but [custom line items](#custom-line-items) can also be created on-the-fly. <Since product="commerce" ver="5.1.0" feature="Custom, ad-hoc line items" />
9797

98-
This section will cover displaying information about what is in a customer’s cart or completed order; to learn about working with an active cart, jump to [Managing Cart contents](#managing-cart-contents)!
98+
Out-of-the-box, line items [variant](../system/products-variants.md), and have a quantity, description, notes, a calculated subtotal, options, adjustments (like tax and shipping costs), and other metadata. Most importantly, though, the line item retains a reference to its purchasable so that it can be refreshed with the latest information from your store while the customer is shopping.
9999

100100
::: tip
101-
Even in the event a product or variant is altered or deleted after a customer checks out, enough information is memoized on each line item to reconstruct what was purchased, and how much was paid.
101+
In the event a product or variant is altered or deleted after a customer checks out, enough information is memoized on each line item to reconstruct what was purchased, and how much was paid. Some of this is recorded directly on the line item (like [prices](#prices) and its [physical attributes](#physical-properties)), and some is stored as metadata (like [options](#line-item-options-and-notes) and [snapshots](../system/purchasables.md#snapshots)).
102102
:::
103103

104+
To learn about working with an active cart, jump to [Managing Cart contents](#managing-cart-contents).
105+
104106
Line items are always returned as an array, even if there is only a single item in the cart. Loop over them to display information about each one:
105107

106108
```twig{2}
@@ -668,7 +670,7 @@ If the customer is a registered user, they may want to continue shopping from an
668670
When a guest with an active cart creates an account, that cart will be remain active after logging in.
669671
:::
670672

671-
You can allow a logged-in customer to see their previously used carts:
673+
You can allow a logged-in customer to see their previous (incomplete) carts:
672674

673675
::: code
674676
```twig
@@ -758,9 +760,11 @@ With that list of carts, you can build a form to switch between multiple carts:
758760
</form>
759761
```
760762

763+
While Commerce combines similar line items in the active cart, this simple form may list the same purchasable more than once.
764+
761765
### Forgetting a Cart
762766

763-
A logged-in customer’s cart is stored in a cookie that persists across sessions, so they can close their browser and return to the store without losing their cart. If the customer logs out, Commerce gives them a new cart.
767+
A logged-in customer’s cart is stored in a cookie that persists across sessions, so they can close their browser and return to the store without losing their cart. If the customer logs out, Commerce assigns the “guest” a new cart.
764768

765769
Removing all the items from a cart doesn’t mean that the cart is forgotten, though—sometimes, fully detaching a cart from the session is preferable to emptying it. To remove a cart from the customer’s session (without logging out or clearing the items), make a `POST` request to the [`cart/forget-cart` action](../reference/controller-actions.md#post-cart-forget-cart). A cart number is _not_ required—Commerce can only detach the customer’s current cart.
766770

docs/commerce/5.x/development/making-payments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ Like the [`commerce/payments/pay`](../reference/controller-actions.md#post-payme
169169
- [requireShippingAddressAtCheckout](../configure.md#requireshippingaddressatcheckout)
170170

171171
::: warning
172-
If you enable order completion without payment, completed orders will have the same status as any others. Don’t forget to make sure store managers are aware of the change and prepared to confirm payment before fulfilling orders!
172+
If you enable order completion without payment, completed orders will have the same status as any others. Make sure store managers are aware of this subtle difference and are prepared to confirm payment before fulfilling orders!
173173

174-
If you use these workflows, consider adding columns to the main Order [element indexes](/5.x/system/elements.md#indexes) for _Date Paid_ or _Amount Paid_ so that it is clear which orders need attention.
174+
If you use these workflows, consider adding columns to the main Order [element indexes](/5.x/system/elements.md#indexes) for _Date Paid_, _Paid Status_, or _Amount Paid_ so that it is clear which orders need attention.
175175
:::
176176

177177
### Checkout with Partial Payment
42.8 KB
Loading
Loading
Loading
-49.9 KB
Binary file not shown.
Loading
-72.8 KB
Binary file not shown.

docs/commerce/5.x/reference/fields.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ See [Relations](/5.x/system/relations.md) for more info on the `relatedTo` param
6363
Variants fields behave almost identically to [products fields](#products-field), except they directly relate specific variant elements.
6464

6565
Unlike the products field, however, you cannot create variants directly from the element selection modal—variants are always created within the context of a product, which we don’t have, in this view.
66+
67+
## Link Field <Since product="commerce" ver="5.1.0" feature="Selecting product elements in Craft’s Link field" />
68+
69+
When configuring Craft’s native [Link field](/5.x/reference/field-types/link.md), you can enable selection of Commerce products.

docs/commerce/5.x/reference/permissions.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
# Store Management
22

3-
Craft Commerce adds user permissions you can customize in any of your [Craft CMS user groups](/4.x/user-management.md).
3+
Commerce embraces Craft’s flexible [user groups and permissions structure](/5.x/system/user-management.md) and gives you fine-grained control over who can access and manage critical ecommerce data.
44

5-
## Store Managers
5+
::: tip
6+
User groups can also be leveraged in [catalog pricing rules](../system/pricing-rules.md) to grant customers access to special discounts.
7+
:::
68

7-
While you have complete control over any user groups and permissions you establish for a Craft project, most projects tend to include two types of users: technical administrators and content editors.
9+
## Store Managers
810

9-
Technical administrators are most often developers that use admin accounts for full system access, while content editors have control panel access use the control panel with more limited permissions to manage content without changing system configuration.
11+
Throughout the documentation, we use the shorthand “store managers” for users who have been granted access to a subset of Commerce’s back-office features (like [product management](../system/products-variants.md), [pricing rules](../system/pricing-rules.md), and [inventory](../system/inventory.md), or handling [orders](../system/orders-carts.md))—but it is not a predefined or codified role! You are always in control of your users’ capabilities.
1012

11-
Commerce stores typically involve another tier of control panel users we’ll refer to throughout the documentation as “Store Managers”. These are users that have permissions tailored for managing the operation of a store, working with products and orders and pricing. The role is more permissive than that of a content editor, without full admin access to settings that could interrupt the functionality of the store.
13+
The exact permissions you choose for these store managers will depend on the needs of your organization and site.
1214

13-
The exact permissions you choose for “Store Managers” will depend on the needs of your organization and site.
15+
::: tip
16+
There may be some overlap between a store manager’s role and that of a regular content author—depending on your content model (specifically, how much content is directly attached to product and variant elements vs. entries), authors may need to be able to update products!
17+
:::
1418

1519
## Permissions
1620

1721
The following Commerce permissions are available for Craft users and user groups.
1822

19-
![Screenshot of Commerce user permissions, which cover products, orders, promotions, subscriptions, shipping, taxes, and store settings](../images/user-permissions.png)
20-
2123
### Access Craft Commerce
2224

2325
Whether the user is able to access the Commerce section of the control panel.
2426

2527
::: tip
26-
Unlike the others, you’ll find it under Craft’s **Access the control panel** permission:
28+
Unlike other Commerce-specific permissions, this one is nested inside Craft’s **Access the control panel** permission. Any user that needs access to Commerce management tools must also be given access to the control panel—but you can design your roles such that those users don’t implicitly have control over other content types or plugins.
2729

2830
![Screenshot of General permissions with an “Access Craft Commerce” checkbox under “Access the control panel”](../images/general-permissions.png =375x375)
2931
:::
3032

31-
### Manage products
33+
### Manage _Product Type Name_ products
3234

3335
Whether the user can manage products, with each product type having its own create and delete permissions.
3436

docs/commerce/5.x/system/discounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can restrict a discount to specific purchasables by enabling the **Only matc
3737
If this is enabled and no purchasables are selected, the discount will never match.
3838

3939
::: warning
40-
Only variants marked as **Promotable** will match discount conditions (even when it is explicitly selected).
40+
Only variants marked as **Promotable** will match discount conditions (even if they are explicitly selected in one of the rules).
4141
:::
4242

4343
## Discount Conditions Rules

0 commit comments

Comments
 (0)