My website i have updatecart on qty btn change event call so with ajax how to created a plugin for this.

enter image description here

  • you want to update qty to ajax base update the cart and subtotal / order total. – HIren Kadivar Apr 2 '19 at 4:45


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">    
    <type name="Magento\Checkout\Model\Cart">
        <plugin name="update_cart" type="Vendor\Module\Plugin\UpdateCart" sortOrder="999" disabled="false"  />



namespace Vendor\Module\Plugin;

 * Class afterUpdateItems
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
class UpdateCart {

    public function afterUpdateItems($subject, $result, $data)
        foreach ($data as $itemId => $itemInfo) {
            $item = $subject->getQuote()->getItemById($itemId);
        return $result;
  • I think this has nothing to do with the question – Marius Apr 1 '19 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.