Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
create_quote_on_eu_website_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
14 
16 $registry = Bootstrap::getObjectManager()->get(Registry::class);
17 
19 $cartRepository = Bootstrap::getObjectManager()->get(CartRepositoryInterface::class);
21 $searchCriteriaBuilder = Bootstrap::getObjectManager()->get(SearchCriteriaBuilder::class);
22 
24  ->addFilter('reserved_order_id', 'created_order_for_test')
25  ->create();
26 
27 $registry->unregister('isSecureArea');
28 $registry->register('isSecureArea', true);
29 
31 $carts = $cartRepository->getList($searchCriteria)->getItems();
32 foreach ($carts as $cart) {
33  $cartRepository->delete($cart);
34 }
35 
36 $registry->unregister('isSecureArea');
37 $registry->register('isSecureArea', false);
38 
39 /* Refresh stores memory cache */
40 Bootstrap::getObjectManager()->get(StoreManagerInterface::class)->reinitStores();