New answers tagged

2

You can get the quantity before add to cart using observer event controller_action_predispatch_checkout_cart_add Please use as below app/code/Vendor/Module/etc/frontend/events.xml <?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/...


3

please use below pluging to perform anything before addtocart app/code/Vendor/Extension/etc/di.xml <type name="Magento\Checkout\Model\Cart"> <plugin name="prevent_add_to" type="Vendor\Extension\Plugin\Beforeaddtocart"/> </type> app/code/Vendor/Extension/Plugin/Beforeaddtocart.php <?php ...


0

In my opinion you should create a custom attribute for the product and use the cart rules that magento 2 manages basically Cheers


1

I solved this following this tutorial Magento 2 : How to load quote by quote id looks like the load function is depreciated and doesn't works anymore.


0

You don't have to edit any template, you can simply do it with xml. Add Magento_Checkout/layout/checkout_cart_item_renderers.xml to your theme: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">...


1

on Magento ver. 2.3.4, that option is placed in: Admin -> Stores -> Configuration -> Sales -> Checkout -> Mini Cart (tab) -> Display Mini Cart : No It is related to that function - getIsNeedToDisplaySideBar(), part of that file module-checkout\view\frontend\templates\cart\minicart.phtml And your minicart should redirect to -> ...


0

Issue reolved basically i was trying to hide some content in Magento calue theme using display:none property of below div and it effected the minicart and disabled mini cart also. <div class="message info empty"><div class="">We can't find products matching the selection.</div></div>


0

Something like this would work in Magento 2. <!-- ko if: getCartParam('summary_count') > 1 || getCartParam('summary_count') == 0 --> <span>items</span> <!-- /ko --> <!-- ko if: getCartParam('summary_count') == 1 --> <span>item</span> <!-- /ko -->


0

I think you are missing this: if($subTotal < $shippingThresholdPrice) { $shippingPrice = 5; } $this->cart->getQuote()->collectTotals() $subTotal = $this->$cart->getQuote()->getSubtotal(); $grandTotal = $this->$cart->getQuote()->getGrandTotal(); $subtotal_with_discount = $this->$cart->getQuote()->getData('...


1

Try to replace below code in your file <?php namespace Test\Checkout\Controller\Rewrite\Checkout\Cart; use Magento\Framework\Data\Form\FormKey; use Magento\Checkout\Model\Cart; use Magento\Catalog\Model\Product; class Index extends \Magento\Checkout\Controller\Cart\Index { protected $scopeConfig; protected $formKey; protected $cart; ...


Top 50 recent answers are included