如何在优惠券规则 Magento 2 上添加自定义选项值
How to add Custom option value on coupon rules Magneto 2
如何在优惠券规则 Magneto 2 上添加自定义选项值。我有一个产品有一些自定义选项,如尺寸、颜色等,具有不同的值,我想在尺寸 = 7' 的基础上给予折扣。我不想使用 sku 自定义选项。请告诉我如何解决它。
https://github.com/Turiknox/magento2-custom-total
我用于折扣的模具,但我遇到了问题。
一个数据我无法获取购物车信息
$obj = $bootstrap->getObjectManager();
// Set the state (not sure if this is neccessary)
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
// Getting the object managers dependencies
$quote = $obj->get('Magento\Checkout\Model\Session')->getQuote();
$helper = $obj->get('\Magento\Checkout\Helper\Cart');
// Get quote and cart items collection
$quote = $helper->getQuote();
$quoteitems = $quote->getAllItems();
$coupon_code = 'Test23';
// Get cart contents
$cart= $helper->getCart();
foreach ($quoteitems as $item)
{
}
进入无限循环。
这个 运行 速度很快,这就是为什么我们无法在此处加载报价总额,要获得折扣,您必须设置允许提供折扣的会话核心 cookie...
如何在优惠券规则 Magneto 2 上添加自定义选项值。我有一个产品有一些自定义选项,如尺寸、颜色等,具有不同的值,我想在尺寸 = 7' 的基础上给予折扣。我不想使用 sku 自定义选项。请告诉我如何解决它。 https://github.com/Turiknox/magento2-custom-total 我用于折扣的模具,但我遇到了问题。 一个数据我无法获取购物车信息
$obj = $bootstrap->getObjectManager();
// Set the state (not sure if this is neccessary)
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
// Getting the object managers dependencies
$quote = $obj->get('Magento\Checkout\Model\Session')->getQuote();
$helper = $obj->get('\Magento\Checkout\Helper\Cart');
// Get quote and cart items collection
$quote = $helper->getQuote();
$quoteitems = $quote->getAllItems();
$coupon_code = 'Test23';
// Get cart contents
$cart= $helper->getCart();
foreach ($quoteitems as $item)
{
}
进入无限循环。
这个 运行 速度很快,这就是为什么我们无法在此处加载报价总额,要获得折扣,您必须设置允许提供折扣的会话核心 cookie...