You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commerce/5.x/development/cart.md
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -93,14 +93,16 @@ Craft includes a powerful [internationalization engine](guide:tutorial-i18n#plur
93
93
94
94
### Line Items
95
95
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. <Sinceproduct="commerce"ver="5.1.0"feature="Custom, ad-hoc line items" />
97
97
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.
99
99
100
100
::: 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)).
102
102
:::
103
103
104
+
To learn about working with an active cart, jump to [Managing Cart contents](#managing-cart-contents).
105
+
104
106
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:
105
107
106
108
```twig{2}
@@ -668,7 +670,7 @@ If the customer is a registered user, they may want to continue shopping from an
668
670
When a guest with an active cart creates an account, that cart will be remain active after logging in.
669
671
:::
670
672
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:
672
674
673
675
::: code
674
676
```twig
@@ -758,9 +760,11 @@ With that list of carts, you can build a form to switch between multiple carts:
758
760
</form>
759
761
```
760
762
763
+
While Commerce combines similar line items in the active cart, this simple form may list the same purchasable more than once.
764
+
761
765
### Forgetting a Cart
762
766
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.
764
768
765
769
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.
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!
173
173
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.
Copy file name to clipboardExpand all lines: docs/commerce/5.x/reference/fields.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -63,3 +63,7 @@ See [Relations](/5.x/system/relations.md) for more info on the `relatedTo` param
63
63
Variants fields behave almost identically to [products fields](#products-field), except they directly relate specific variant elements.
64
64
65
65
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 <Sinceproduct="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.
Copy file name to clipboardExpand all lines: docs/commerce/5.x/reference/permissions.md
+12-10Lines changed: 12 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,36 @@
1
1
# Store Management
2
2
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.
4
4
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
+
:::
6
8
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
8
10
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.
10
12
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.
12
14
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
+
:::
14
18
15
19
## Permissions
16
20
17
21
The following Commerce permissions are available for Craft users and user groups.
18
22
19
-

20
-
21
23
### Access Craft Commerce
22
24
23
25
Whether the user is able to access the Commerce section of the control panel.
24
26
25
27
::: 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.
27
29
28
30

29
31
:::
30
32
31
-
### Manage products
33
+
### Manage _Product Type Name_products
32
34
33
35
Whether the user can manage products, with each product type having its own create and delete permissions.
0 commit comments