Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
order_express_with_invoice_and_creditmemo.php
Go to the documentation of this file.
1 <?php
10 
11 require __DIR__ . '/order_express_with_invoice_and_shipping.php';
12 
14 $creditmemoFactory = $objectManager->create(CreditmemoFactory::class);
16 $creditmemo = $creditmemoFactory->createByInvoice($invoice, $invoice->getData());
17 
18 $creditmemo->setOrder($order);
19 $creditmemo->setState(Creditmemo::STATE_REFUNDED);
20 $creditmemo->setIncrementId('100000001');
21 $creditmemo->setGrandTotal($itemsAmount);
22 
24 $creditMemoRepository = $objectManager->get(CreditmemoRepositoryInterface::class);
$objectManager
Definition: bootstrap.php:17
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$order
Definition: order.php:55
$invoice