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. Apr 2, 2019 at 4:45

1 Answer 1



<?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, 2019 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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