Magento - Remove tax from all products quote. (Update) The Next CEO of Stack OverflowHow to create an new observer on the event catalog_product_save_beforeHolepunching of header in magento storeLearning Magento from reviewing the core filesRemove Tax & Shipping from this success.phtml code :(How to share data between Observers?Retrieve Quote Item ID after added to the cartMagento: Adding block from observer programmaticallyIs there an event that fires when the cart/quote is empty?When Adding a product to cart programatically ,the price of the product becomes zero ($0.00)Simple Observer not firing on eventRemove all products from one category programmatically

In excess I'm lethal

Why am I allowed to create multiple unique pointers from a single object?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

sp_blitzCache results Memory grants

Elegant way to replace substring in a regex with optional groups in Python?

Sending manuscript to multiple publishers

How did people program for Consoles with multiple CPUs?

Is it possible to search for a directory/file combination?

How to count occurrences of text in a file?

What is "(CFMCC)" on an ILS approach chart?

How to safely derail a train during transit?

Multiple labels for a single equation

Which kind of appliances can one connect to electric sockets located in an airplane's toilet?

Why don't programming languages automatically manage the synchronous/asynchronous problem?

How to start emacs in "nothing" mode (`fundamental-mode`)

Does it take more energy to get to Venus or to Mars?

What was the first Unix version to run on a microcomputer?

Preparing Indesign booklet with .psd graphics for print

Is there a way to save my career from absolute disaster?

Why does the UK parliament need a vote on the political declaration?

Can you replace a racial trait cantrip when leveling up?

How did the Bene Gesserit know how to make a Kwisatz Haderach?

How does the mv command work with external drives?

Won the lottery - how do I keep the money?



Magento - Remove tax from all products quote. (Update)



The Next CEO of Stack OverflowHow to create an new observer on the event catalog_product_save_beforeHolepunching of header in magento storeLearning Magento from reviewing the core filesRemove Tax & Shipping from this success.phtml code :(How to share data between Observers?Retrieve Quote Item ID after added to the cartMagento: Adding block from observer programmaticallyIs there an event that fires when the cart/quote is empty?When Adding a product to cart programatically ,the price of the product becomes zero ($0.00)Simple Observer not firing on eventRemove all products from one category programmatically










0















I saw there are some post like this but I tried that answer and dit not work.



I am learning how to use magento, and What I wan to try is remove all the tax from the cliente when them have add 3 products to the cart.



I am using an observer event. And the function it run is:



Here is the config.xml



<events>
<checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
<observers>
<checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>descuentoiva/observer</class> <!-- observers class alias -->
<method>addCheckout</method> <!-- observer's method to be called -->
<args></args> <!-- additional arguments passed to observer -->
</checkout_cart_add_product_complete_handler>
</observers>
</checkout_cart_add_product_complete>
<events>


And this is my actual code for the fuction:



public function addCheckout(Varien_Event_Observer $observer)

$cart = Mage::getModel('checkout/cart')->getQuote();
if (count($cart->getAllItems()) >= 3)
$products = $cart->getAllVisibleItems();
foreach($products as $item)
echo $item->getPriceInclTax()."<br>";
if ($item->getTaxAmount() > 0)
$item->setTaxPercent(0);
$item->setTaxAmount(0);
$item->setBaseTaxAmount(0);
$item->save();


$cart->save();

#die("patata");



But when I look the checkout it did not work.










share|improve this question




























    0















    I saw there are some post like this but I tried that answer and dit not work.



    I am learning how to use magento, and What I wan to try is remove all the tax from the cliente when them have add 3 products to the cart.



    I am using an observer event. And the function it run is:



    Here is the config.xml



    <events>
    <checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
    <observers>
    <checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
    <type>model</type> <!-- class method call type; valid are model, object and singleton -->
    <class>descuentoiva/observer</class> <!-- observers class alias -->
    <method>addCheckout</method> <!-- observer's method to be called -->
    <args></args> <!-- additional arguments passed to observer -->
    </checkout_cart_add_product_complete_handler>
    </observers>
    </checkout_cart_add_product_complete>
    <events>


    And this is my actual code for the fuction:



    public function addCheckout(Varien_Event_Observer $observer)

    $cart = Mage::getModel('checkout/cart')->getQuote();
    if (count($cart->getAllItems()) >= 3)
    $products = $cart->getAllVisibleItems();
    foreach($products as $item)
    echo $item->getPriceInclTax()."<br>";
    if ($item->getTaxAmount() > 0)
    $item->setTaxPercent(0);
    $item->setTaxAmount(0);
    $item->setBaseTaxAmount(0);
    $item->save();


    $cart->save();

    #die("patata");



    But when I look the checkout it did not work.










    share|improve this question


























      0












      0








      0








      I saw there are some post like this but I tried that answer and dit not work.



      I am learning how to use magento, and What I wan to try is remove all the tax from the cliente when them have add 3 products to the cart.



      I am using an observer event. And the function it run is:



      Here is the config.xml



      <events>
      <checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
      <observers>
      <checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
      <type>model</type> <!-- class method call type; valid are model, object and singleton -->
      <class>descuentoiva/observer</class> <!-- observers class alias -->
      <method>addCheckout</method> <!-- observer's method to be called -->
      <args></args> <!-- additional arguments passed to observer -->
      </checkout_cart_add_product_complete_handler>
      </observers>
      </checkout_cart_add_product_complete>
      <events>


      And this is my actual code for the fuction:



      public function addCheckout(Varien_Event_Observer $observer)

      $cart = Mage::getModel('checkout/cart')->getQuote();
      if (count($cart->getAllItems()) >= 3)
      $products = $cart->getAllVisibleItems();
      foreach($products as $item)
      echo $item->getPriceInclTax()."<br>";
      if ($item->getTaxAmount() > 0)
      $item->setTaxPercent(0);
      $item->setTaxAmount(0);
      $item->setBaseTaxAmount(0);
      $item->save();


      $cart->save();

      #die("patata");



      But when I look the checkout it did not work.










      share|improve this question
















      I saw there are some post like this but I tried that answer and dit not work.



      I am learning how to use magento, and What I wan to try is remove all the tax from the cliente when them have add 3 products to the cart.



      I am using an observer event. And the function it run is:



      Here is the config.xml



      <events>
      <checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
      <observers>
      <checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
      <type>model</type> <!-- class method call type; valid are model, object and singleton -->
      <class>descuentoiva/observer</class> <!-- observers class alias -->
      <method>addCheckout</method> <!-- observer's method to be called -->
      <args></args> <!-- additional arguments passed to observer -->
      </checkout_cart_add_product_complete_handler>
      </observers>
      </checkout_cart_add_product_complete>
      <events>


      And this is my actual code for the fuction:



      public function addCheckout(Varien_Event_Observer $observer)

      $cart = Mage::getModel('checkout/cart')->getQuote();
      if (count($cart->getAllItems()) >= 3)
      $products = $cart->getAllVisibleItems();
      foreach($products as $item)
      echo $item->getPriceInclTax()."<br>";
      if ($item->getTaxAmount() > 0)
      $item->setTaxPercent(0);
      $item->setTaxAmount(0);
      $item->setBaseTaxAmount(0);
      $item->save();


      $cart->save();

      #die("patata");



      But when I look the checkout it did not work.







      magento-1.9 code code-analysis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 55 mins ago









      Teja Bhagavan Kollepara

      3,01241949




      3,01241949










      asked Jun 9 '16 at 11:21









      mohamet montemohamet monte

      66




      66




















          1 Answer
          1






          active

          oldest

          votes


















          0














          You also have to config your event in config.xml. Learn here



          Now, we need to use this event checkout_cart_product_add_after and checkout_cart_product_update_after.



          In your config.xml



          <global>
          ..
          ..
          <events>
          <checkout_cart_product_add_after>
          <observers>
          <my_module_product_add_after>
          <type>singleton</type>
          <class>modulename/observer</class>
          <method>checkout_cart_product_add_after</method>
          </my_module_product_add_after>
          </observers>
          </checkout_cart_product_add_after>
          </events>
          ..
          ..
          </global>


          Now function checkout_cart_product_add_after() in model/observer.php



          public function checkout_cart_product_add_after(Varien_Event_Observer $observer)

          $quote = $observer->getEvent()->getQuote();
          if (count($quote->getAllItems()) >= 3)
          $items = $quote->getAllVisibleItems();
          foreach($items as $item)
          $item
          ->setTaxAmount(0)
          ->setBaseTaxAmount(0)
          ->save();


          Mage::log('my log', null, 'my-log.log'); //creates log file if this function is called



          This will set tax to 0 for all items that are in cart. You would want to check sales_flat_quote_item table.



          Because you would also want to check this event on item update on cart, so you have to set another event for this checkout_cart_product_update_after.



          you can call same function for this event too.



          I haven't tested, but this should work.






          share|improve this answer

























          • I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

            – mohamet monte
            Jun 9 '16 at 12:36











          • It did not work Adarsh

            – mohamet monte
            Jun 10 '16 at 7:09











          • Any error? And did it create a log fine called my-log?

            – Adarsh Khatri
            Jun 10 '16 at 7:28











          • Yes it create the log

            – mohamet monte
            Jun 10 '16 at 7:39












          • Check your var/log folder

            – Adarsh Khatri
            Jun 10 '16 at 7:43











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f120158%2fmagento-remove-tax-from-all-products-quote-update%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You also have to config your event in config.xml. Learn here



          Now, we need to use this event checkout_cart_product_add_after and checkout_cart_product_update_after.



          In your config.xml



          <global>
          ..
          ..
          <events>
          <checkout_cart_product_add_after>
          <observers>
          <my_module_product_add_after>
          <type>singleton</type>
          <class>modulename/observer</class>
          <method>checkout_cart_product_add_after</method>
          </my_module_product_add_after>
          </observers>
          </checkout_cart_product_add_after>
          </events>
          ..
          ..
          </global>


          Now function checkout_cart_product_add_after() in model/observer.php



          public function checkout_cart_product_add_after(Varien_Event_Observer $observer)

          $quote = $observer->getEvent()->getQuote();
          if (count($quote->getAllItems()) >= 3)
          $items = $quote->getAllVisibleItems();
          foreach($items as $item)
          $item
          ->setTaxAmount(0)
          ->setBaseTaxAmount(0)
          ->save();


          Mage::log('my log', null, 'my-log.log'); //creates log file if this function is called



          This will set tax to 0 for all items that are in cart. You would want to check sales_flat_quote_item table.



          Because you would also want to check this event on item update on cart, so you have to set another event for this checkout_cart_product_update_after.



          you can call same function for this event too.



          I haven't tested, but this should work.






          share|improve this answer

























          • I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

            – mohamet monte
            Jun 9 '16 at 12:36











          • It did not work Adarsh

            – mohamet monte
            Jun 10 '16 at 7:09











          • Any error? And did it create a log fine called my-log?

            – Adarsh Khatri
            Jun 10 '16 at 7:28











          • Yes it create the log

            – mohamet monte
            Jun 10 '16 at 7:39












          • Check your var/log folder

            – Adarsh Khatri
            Jun 10 '16 at 7:43















          0














          You also have to config your event in config.xml. Learn here



          Now, we need to use this event checkout_cart_product_add_after and checkout_cart_product_update_after.



          In your config.xml



          <global>
          ..
          ..
          <events>
          <checkout_cart_product_add_after>
          <observers>
          <my_module_product_add_after>
          <type>singleton</type>
          <class>modulename/observer</class>
          <method>checkout_cart_product_add_after</method>
          </my_module_product_add_after>
          </observers>
          </checkout_cart_product_add_after>
          </events>
          ..
          ..
          </global>


          Now function checkout_cart_product_add_after() in model/observer.php



          public function checkout_cart_product_add_after(Varien_Event_Observer $observer)

          $quote = $observer->getEvent()->getQuote();
          if (count($quote->getAllItems()) >= 3)
          $items = $quote->getAllVisibleItems();
          foreach($items as $item)
          $item
          ->setTaxAmount(0)
          ->setBaseTaxAmount(0)
          ->save();


          Mage::log('my log', null, 'my-log.log'); //creates log file if this function is called



          This will set tax to 0 for all items that are in cart. You would want to check sales_flat_quote_item table.



          Because you would also want to check this event on item update on cart, so you have to set another event for this checkout_cart_product_update_after.



          you can call same function for this event too.



          I haven't tested, but this should work.






          share|improve this answer

























          • I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

            – mohamet monte
            Jun 9 '16 at 12:36











          • It did not work Adarsh

            – mohamet monte
            Jun 10 '16 at 7:09











          • Any error? And did it create a log fine called my-log?

            – Adarsh Khatri
            Jun 10 '16 at 7:28











          • Yes it create the log

            – mohamet monte
            Jun 10 '16 at 7:39












          • Check your var/log folder

            – Adarsh Khatri
            Jun 10 '16 at 7:43













          0












          0








          0







          You also have to config your event in config.xml. Learn here



          Now, we need to use this event checkout_cart_product_add_after and checkout_cart_product_update_after.



          In your config.xml



          <global>
          ..
          ..
          <events>
          <checkout_cart_product_add_after>
          <observers>
          <my_module_product_add_after>
          <type>singleton</type>
          <class>modulename/observer</class>
          <method>checkout_cart_product_add_after</method>
          </my_module_product_add_after>
          </observers>
          </checkout_cart_product_add_after>
          </events>
          ..
          ..
          </global>


          Now function checkout_cart_product_add_after() in model/observer.php



          public function checkout_cart_product_add_after(Varien_Event_Observer $observer)

          $quote = $observer->getEvent()->getQuote();
          if (count($quote->getAllItems()) >= 3)
          $items = $quote->getAllVisibleItems();
          foreach($items as $item)
          $item
          ->setTaxAmount(0)
          ->setBaseTaxAmount(0)
          ->save();


          Mage::log('my log', null, 'my-log.log'); //creates log file if this function is called



          This will set tax to 0 for all items that are in cart. You would want to check sales_flat_quote_item table.



          Because you would also want to check this event on item update on cart, so you have to set another event for this checkout_cart_product_update_after.



          you can call same function for this event too.



          I haven't tested, but this should work.






          share|improve this answer















          You also have to config your event in config.xml. Learn here



          Now, we need to use this event checkout_cart_product_add_after and checkout_cart_product_update_after.



          In your config.xml



          <global>
          ..
          ..
          <events>
          <checkout_cart_product_add_after>
          <observers>
          <my_module_product_add_after>
          <type>singleton</type>
          <class>modulename/observer</class>
          <method>checkout_cart_product_add_after</method>
          </my_module_product_add_after>
          </observers>
          </checkout_cart_product_add_after>
          </events>
          ..
          ..
          </global>


          Now function checkout_cart_product_add_after() in model/observer.php



          public function checkout_cart_product_add_after(Varien_Event_Observer $observer)

          $quote = $observer->getEvent()->getQuote();
          if (count($quote->getAllItems()) >= 3)
          $items = $quote->getAllVisibleItems();
          foreach($items as $item)
          $item
          ->setTaxAmount(0)
          ->setBaseTaxAmount(0)
          ->save();


          Mage::log('my log', null, 'my-log.log'); //creates log file if this function is called



          This will set tax to 0 for all items that are in cart. You would want to check sales_flat_quote_item table.



          Because you would also want to check this event on item update on cart, so you have to set another event for this checkout_cart_product_update_after.



          you can call same function for this event too.



          I haven't tested, but this should work.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 '17 at 12:55









          Community

          1




          1










          answered Jun 9 '16 at 12:10









          Adarsh KhatriAdarsh Khatri

          6,78511644




          6,78511644












          • I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

            – mohamet monte
            Jun 9 '16 at 12:36











          • It did not work Adarsh

            – mohamet monte
            Jun 10 '16 at 7:09











          • Any error? And did it create a log fine called my-log?

            – Adarsh Khatri
            Jun 10 '16 at 7:28











          • Yes it create the log

            – mohamet monte
            Jun 10 '16 at 7:39












          • Check your var/log folder

            – Adarsh Khatri
            Jun 10 '16 at 7:43

















          • I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

            – mohamet monte
            Jun 9 '16 at 12:36











          • It did not work Adarsh

            – mohamet monte
            Jun 10 '16 at 7:09











          • Any error? And did it create a log fine called my-log?

            – Adarsh Khatri
            Jun 10 '16 at 7:28











          • Yes it create the log

            – mohamet monte
            Jun 10 '16 at 7:39












          • Check your var/log folder

            – Adarsh Khatri
            Jun 10 '16 at 7:43
















          I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

          – mohamet monte
          Jun 9 '16 at 12:36





          I will try but I thinked that prove i done and dit not work. And config.xml is configured. When I use again my own computer I will update all data with config.xml and the prove. Ty Adarsh

          – mohamet monte
          Jun 9 '16 at 12:36













          It did not work Adarsh

          – mohamet monte
          Jun 10 '16 at 7:09





          It did not work Adarsh

          – mohamet monte
          Jun 10 '16 at 7:09













          Any error? And did it create a log fine called my-log?

          – Adarsh Khatri
          Jun 10 '16 at 7:28





          Any error? And did it create a log fine called my-log?

          – Adarsh Khatri
          Jun 10 '16 at 7:28













          Yes it create the log

          – mohamet monte
          Jun 10 '16 at 7:39






          Yes it create the log

          – mohamet monte
          Jun 10 '16 at 7:39














          Check your var/log folder

          – Adarsh Khatri
          Jun 10 '16 at 7:43





          Check your var/log folder

          – Adarsh Khatri
          Jun 10 '16 at 7:43

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f120158%2fmagento-remove-tax-from-all-products-quote-update%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

          How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2

          Nissan Patrol Зміст Перше покоління — 4W60 (1951-1960) | Друге покоління — 60 series (1960-1980) | Третє покоління (1980–2002) | Четверте покоління — Y60 (1987–1998) | П'яте покоління — Y61 (1997–2013) | Шосте покоління — Y62 (2010- ) | Посилання | Зноски | Навігаційне менюОфіційний український сайтТест-драйв Nissan Patrol 2010 7-го поколінняNissan PatrolКак мы тестировали Nissan Patrol 2016рвиправивши або дописавши її