We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

Here we can get cart rule from quote, so we can apply cart rule based on quote

This is making module : Magemonkeys/Generalcart

This is block file

<?php
namespace MagemonkeysGeneralcartBlock;

class Simplequote extends MagentoFrameworkViewElementTemplate
{
    protected $sessionmodelFactory;
	protected $quotemodelFactory;

    public function __construct(
        MagentoFrameworkViewElementTemplateContext $context,
        MagentoCheckoutModelSessionFactory $sessionmodelFactory,
        MagentoQuoteModelQuoteFactory $quotemodelFactory,
        array $data = []
    ) {
        $this->sessionFactory = $sessionmodelFactory;
        $this->quoteFactory = $quotemodelFactory;
        parent::__construct($context, $data);
    }

    public function getAppliedIdsforrule()
    {
        $quoteId = $this->sessionFactory->create()->getQuote()->getId();
        $quote = $this->quoteFactory->create()->loadActive($quoteId);
        $salesruleIds = explode(',', $quote->getAppliedRuleIds());
        return $salesruleIds;
    }
}

we can call this getAppliedIdsforrule() function in block
so its return rule ids.

field_5bfb909c5ccae

    Recent Articles
    Get a Free Quote

      Let’s initiate a discussion!!