Skip to content

Commit

Permalink
Fix order create docs #1284 (#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson authored Oct 6, 2023
1 parent 73a2bc5 commit 66a2541
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/core/reference/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ $order = \Lunar\Models\Order::create([/** .. */]);

// Recommended way
$order = Cart::first()->createOrder(
allowMultiple: false,
draftOrderId: null,
allowMultipleOrders: false,
orderIdToUpdate: null,
);
```

- `allowMultiple` - Generally carts will only have one draft order associated, however if you want to allow carts to
- `allowMultipleOrders` - Generally carts will only have one draft order associated, however if you want to allow carts to
have multiple, you can pass `true` here.
- `draftOrderId` - If you want to be sure you're going to get the existing/correct order back, you can pass an ID of a
draft order here to use, note it does have to relate to this cart already.
- `orderIdToUpdate` - You can optionally pass the ID of an order to update instead of attempting to create a new order, this must be a draft order i.e. a null `placed_at` and related to the cart.

The underlying class for creating an order is `Lunar\Actions\Carts\CreateOrder`, you are free to override this in the
config file `config/cart.php`
Expand Down

1 comment on commit 66a2541

@vercel
Copy link

@vercel vercel bot commented on 66a2541 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.