E commerce 如何在Magento 2结账时从报价中获得折扣
我有这个url谁有许多引用方法从Magento 2。请注意,Quote是一个类,它在magento 2中具有来自签出页面的数据 网址: 但我在javascript中没有看到像CheckoutConfig这样的方法,它的基本折扣额类似于图像: 如何从结帐页面Magento 2以编程方式在PHP后端获取基本折扣金额 我不应该使用javascript,因为这将导致安全性失败您必须使用:E commerce 如何在Magento 2结账时从报价中获得折扣,e-commerce,magento2,checkout,quote,E Commerce,Magento2,Checkout,Quote,我有这个url谁有许多引用方法从Magento 2。请注意,Quote是一个类,它在magento 2中具有来自签出页面的数据 网址: 但我在javascript中没有看到像CheckoutConfig这样的方法,它的基本折扣额类似于图像: 如何从结帐页面Magento 2以编程方式在PHP后端获取基本折扣金额 我不应该使用javascript,因为这将导致安全性失败您必须使用: public static $carrinho; ... public function execute
public static $carrinho;
...
public function execute()
{
self::$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
self::$carrinho = self::$objectManager->get('\Magento\Checkout\Model\Cart');
....
function getDiscount(){
return (self::$carrinho->getQuote()->getBaseSubtotalWithDiscount() - self::$carrinho->getQuote()->getBaseSubtotal());
}