{"id":3576,"date":"2024-08-28T12:02:02","date_gmt":"2024-08-28T12:02:02","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/how-to-remove-payment-method-from-quote-using-js\/"},"modified":"2025-03-17T05:02:00","modified_gmt":"2025-03-17T05:02:00","slug":"how-to-remove-payment-method-from-quote-using-js","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/how-to-remove-payment-method-from-quote-using-js\/","title":{"rendered":"How to Remove Payment Method From Quote Using Js"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In any e-commerce store, the checkout process should always be flexible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One common error in your Magento 2 checkout is that the quote has an already selected and saved payment method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this simple tutorial, find the JS code to remove this pre-selected and saved payment method and allow your customers to select by themselves.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Remove Payment Method From Quote Using Js<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use this code in your function where you need to remove the payment method :<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">where quote is 'Magento_Checkout\/js\/model\/quote' ,\ncheckoutData is 'Magento_Checkout\/js\/checkout-data' and \ngetPaymentInformation is 'Magento_Checkout\/js\/action\/get-payment-information' objects\n\n\n      var deferred = $.Deferred();\n          quote.setPaymentMethod(null);\n          checkoutData.setSelectedPaymentMethod(null);\n          getPaymentInformation(deferred);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And that\u2019s all!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After this, your customers will surely have a seamless checkout experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Try out this solution, and if you face any error, drop your comment. I would be happy to help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In any e-commerce store, the checkout process should always be flexible. One common error in your Magento 2 checkout is that the quote has an&#8230;<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-3576","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=3576"}],"version-history":[{"count":1,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3576\/revisions"}],"predecessor-version":[{"id":5546,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/3576\/revisions\/5546"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=3576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=3576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=3576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}