Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
quote_with_coupon_saved.php
Go to the documentation of this file.
1 <?php
11 require __DIR__ . '/../../Checkout/_files/discount_10percent.php';
12 
13 require 'quote_with_address_saved.php';
14 
16 $salesRuleFactory = $objectManager->get(\Magento\SalesRule\Model\RuleFactory::class);
18 $salesRuleId = $objectManager->get(\Magento\Framework\Registry::class)
19  ->registry('Magento/Checkout/_file/discount_10percent');
21 $couponCode = $salesRule->getPrimaryCoupon()->getCode();
22 
23 $quote->setCouponCode(trim($couponCode));
24 $quote->collectTotals()->save();
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$quote