Skip to content

Commit

Permalink
Merge pull request #90 from tim-bezhashvyly/patch-1
Browse files Browse the repository at this point in the history
Update checkout example
  • Loading branch information
schmengler authored Apr 25, 2023
2 parents e9c92c1 + 8cd37fd commit bc47a3b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,19 @@ $quote = $cart->getQuote();
Checkout is supported for logged in customers. To create an order, you can simulate the checkout as follows, given a customer fixture with default shipping and billing addresses and a product fixture:

```php
$this->customerFixture->login();
$customerFixture = new CustomerFixture(CustomerBuilder::aCustomer()->withAddresses(
AddressBuilder::anAddress()->asDefaultBilling(),
AddressBuilder::anAddress()->asDefaultShipping()
)->build());
$customerFixture->login();

$checkout = CustomerCheckout::fromCart(
CartBuilder::forCurrentSession()
->withSimpleProduct(
$productFixture->getSku()
)
->withProductRequest(ProductBuilder::aVirtualProduct()->build()->getSku())
->build()
);
$order = $checkout->placeOrder();

$order = $checkout->placeOrder();
```

It will try to select the default addresses and the first available shipping and payment methods.
Expand Down

0 comments on commit bc47a3b

Please sign in to comment.