{"id":1295,"date":"2024-04-05T15:52:45","date_gmt":"2024-04-05T10:22:45","guid":{"rendered":"https:\/\/magecurious.com\/blog\/?p=1295"},"modified":"2024-04-05T15:52:46","modified_gmt":"2024-04-05T10:22:46","slug":"how-to-pre-select-default-payment-method-in-magento-2","status":"publish","type":"post","link":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/","title":{"rendered":"How To Pre Select Default Payment Method In Magento 2"},"content":{"rendered":"\n<p>Hello Everyone,<\/p>\n\n\n\n<p>In this blog, we will learn about how to Pre Select Default Payment Method in the Checkout Page in Magento 2.<\/p>\n\n\n\n<p>Checkout is a One Important Step for customers. So that if the store owner pre-selects the checkout method that customers most select, it&#8217;s easy for customers for a seamless shopping journey.&nbsp;<\/p>\n\n\n\n<p>Without wasting your time, let us guide you straight away. Follow the easy step given below to Pre Select Default Payment Method in Magento 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>STEPS FOR PRE SELECT DEFAULT PAYMENT METHOD IN MAGENTO 2<\/strong><\/h2>\n\n\n\n<p><strong>Step 1: Create requirejs-config.js file<\/strong><\/p>\n\n\n\n<p><strong>app\/code\/Vendor\/Extension\/view\/frontend\/requirejs-config.js<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nvar config = {\n\n\u00a0\u00a0\u00a0\u00a0config: {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mixins: {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#039;Magento_Checkout\/js\/model\/checkout-data-resolver&#039;: {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#039;Vendor_Extension\/js\/model\/checkout-data-resolver&#039;: true\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0}\n\n};\n<\/pre><\/div>\n\n\n<p><strong>Step 2: Create checkout-data-resolver.js file<\/strong><\/p>\n\n\n\n<p><strong>app\/code\/Vendor\/Extension\/view\/frontend\/web\/js\/model\/checkout-data-resolver.js<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\ndefine(&#x5B;\n\n\u00a0\u00a0\u00a0\u00a0&#039;Magento_Checkout\/js\/model\/payment-service&#039;,\n\n\u00a0\u00a0\u00a0\u00a0&#039;Magento_Checkout\/js\/checkout-data&#039;,\n\n\u00a0\u00a0\u00a0\u00a0&#039;Magento_Checkout\/js\/action\/select-payment-method&#039;\n\n], function(\n\n\u00a0\u00a0\u00a0\u00a0paymentService,\n\n\u00a0\u00a0\u00a0\u00a0checkoutData,\n\n\u00a0\u00a0\u00a0\u00a0selectPaymentMethodAction\n\n) {\n\n\u00a0\u00a0\u00a0\u00a0&#039;use strict&#039;;\n\n\u00a0\u00a0\u00a0\u00a0return function(checkoutDataResolver) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0checkoutDataResolver.resolvePaymentMethod = function() {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var availablePaymentMethods = paymentService.getAvailablePaymentMethods(),\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0selectedPaymentMethod = checkoutData.getSelectedPaymentMethod(),\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0paymentMethod = selectedPaymentMethod ? selectedPaymentMethod : &#039;banktransfer&#039;;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/set payment method as per your requirement\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (availablePaymentMethods.length &gt; 0) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0availablePaymentMethods.some(function (payment) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (payment.method == paymentMethod) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0selectPaymentMethodAction(payment);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0};\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return checkoutDataResolver;\n\n\u00a0\u00a0\u00a0\u00a0};\n\n});\n<\/pre><\/div>\n\n\n<p><strong>Step 3: Finally run the below commands<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n$ php bin\/magento setup:upgrade\n\n$ php bin\/magento cache:clean\n\n$ php bin\/magento cache:flush\n<\/pre><\/div>\n\n\n<p><strong>Step 4: Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/wLk2vPnRLyUk5iUtHgtciFwRk2D5aBTXVaD2XkWou9juD3kW36fePwA1JUqKnCNs2CDUkEbFE_xhvFzl_Kgc9QAZB6S2w3FR64C35ibfN-Qex_rJcaJRFQoRICPKGTxh3ZWlVYRoC2_yla98-LX72-U\" alt=\"\"\/><\/figure>\n\n\n\n<div style=\"height:21px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><br><\/strong><strong>Final Thoughts:<\/strong><\/h2>\n\n\n\n<p>So this was the easiest way which we have told you in this blog. This is how you can Pre Select Default Payment Method in Magento 2. Hope you liked the blog.<\/p>\n\n\n\n<p>So quickly go to the comment box and tell me how you like this blog?<\/p>\n\n\n\n<p><strong>Stay tuned with us on our site to get new updates of Magento.<\/strong><\/p>\n\n\n\n<p>Thanks for reading and visiting our site.<\/p>\n\n\n<!-- FeedbackWP Plugin --><div  class=\"rmp-widgets-container rmp-wp-plugin rmp-main-container js-rmp-widgets-container js-rmp-widgets-container--1295 \"  data-post-id=\"1295\">    <!-- Rating widget -->  <div class=\"rmp-rating-widget js-rmp-rating-widget\">          <p class=\"rmp-heading rmp-heading--title\">        How useful was this post?      <\/p>              <p class=\"rmp-heading rmp-heading--subtitle\">        Click on a star to rate it!      <\/p>        <div class=\"rmp-rating-widget__icons\">      <ul class=\"rmp-rating-widget__icons-list js-rmp-rating-icons-list\">                  <li class=\"rmp-rating-widget__icons-list__icon js-rmp-rating-item\" data-descriptive-rating=\"Not at all useful\" data-value=\"1\">              <i class=\"js-rmp-rating-icon rmp-icon rmp-icon--ratings rmp-icon--star rmp-icon--full-highlight\"><\/i>          <\/li>                  <li class=\"rmp-rating-widget__icons-list__icon js-rmp-rating-item\" data-descriptive-rating=\"Somewhat useful\" data-value=\"2\">              <i class=\"js-rmp-rating-icon rmp-icon rmp-icon--ratings rmp-icon--star rmp-icon--full-highlight\"><\/i>          <\/li>                  <li class=\"rmp-rating-widget__icons-list__icon js-rmp-rating-item\" data-descriptive-rating=\"Useful\" data-value=\"3\">              <i class=\"js-rmp-rating-icon rmp-icon rmp-icon--ratings rmp-icon--star rmp-icon--full-highlight\"><\/i>          <\/li>                  <li class=\"rmp-rating-widget__icons-list__icon js-rmp-rating-item\" data-descriptive-rating=\"Fairly useful\" data-value=\"4\">              <i class=\"js-rmp-rating-icon rmp-icon rmp-icon--ratings rmp-icon--star rmp-icon--full-highlight\"><\/i>          <\/li>                  <li class=\"rmp-rating-widget__icons-list__icon js-rmp-rating-item\" data-descriptive-rating=\"Very useful\" data-value=\"5\">              <i class=\"js-rmp-rating-icon rmp-icon rmp-icon--ratings rmp-icon--star rmp-icon--full-highlight\"><\/i>          <\/li>              <\/ul>    <\/div>    <p class=\"rmp-rating-widget__hover-text js-rmp-hover-text\"><\/p>        <button class=\"rmp-rating-widget__submit-btn rmp-btn js-submit-rating-btn\">      Submit Rating    <\/button>    <p class=\"rmp-rating-widget__results js-rmp-results \">      Average rating <span class=\"rmp-rating-widget__results__rating js-rmp-avg-rating\">5<\/span> \/ 5. Vote count: <span class=\"rmp-rating-widget__results__votes js-rmp-vote-count\">2<\/span>    <\/p>    <p class=\"rmp-rating-widget__not-rated js-rmp-not-rated rmp-rating-widget__not-rated--hidden\">      No votes so far! Be the first to rate this post.    <\/p>    <p class=\"rmp-rating-widget__msg js-rmp-msg\"><\/p>  <\/div>  <!--Structured data -->        <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello Everyone, In this blog, we will learn about how to Pre Select Default Payment Method in the Checkout Page in Magento 2. Checkout is a One Important Step for customers. So that if the store owner pre-selects the checkout method that customers most select, it&#8217;s easy for customers for a seamless shopping journey.&nbsp; Without [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Pre Select Default Payment Method In Magento 2 - Magecurious<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Pre Select Default Payment Method In Magento 2 - Magecurious\" \/>\n<meta property=\"og:description\" content=\"Hello Everyone, In this blog, we will learn about how to Pre Select Default Payment Method in the Checkout Page in Magento 2. Checkout is a One Important Step for customers. So that if the store owner pre-selects the checkout method that customers most select, it&#8217;s easy for customers for a seamless shopping journey.&nbsp; Without [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Magecurious\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-05T10:22:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-05T10:22:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"496\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Magecurious\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Magecurious\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Pre Select Default Payment Method In Magento 2 - Magecurious","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"How To Pre Select Default Payment Method In Magento 2 - Magecurious","og_description":"Hello Everyone, In this blog, we will learn about how to Pre Select Default Payment Method in the Checkout Page in Magento 2. Checkout is a One Important Step for customers. So that if the store owner pre-selects the checkout method that customers most select, it&#8217;s easy for customers for a seamless shopping journey.&nbsp; Without [&hellip;]","og_url":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/","og_site_name":"Magecurious","article_published_time":"2024-04-05T10:22:45+00:00","article_modified_time":"2024-04-05T10:22:46+00:00","og_image":[{"width":1200,"height":496,"url":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","type":"image\/png"}],"author":"Magecurious","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Magecurious","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/"},"author":{"name":"Magecurious","@id":"https:\/\/magecurious.com\/blog\/#\/schema\/person\/6bced7da0991e7fbbd4550006a6494e2"},"headline":"How To Pre Select Default Payment Method In Magento 2","datePublished":"2024-04-05T10:22:45+00:00","dateModified":"2024-04-05T10:22:46+00:00","mainEntityOfPage":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/"},"wordCount":203,"commentCount":0,"publisher":{"@id":"https:\/\/magecurious.com\/blog\/#organization"},"image":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","articleSection":["Magento 2 Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/","url":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/","name":"How To Pre Select Default Payment Method In Magento 2 - Magecurious","isPartOf":{"@id":"https:\/\/magecurious.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","datePublished":"2024-04-05T10:22:45+00:00","dateModified":"2024-04-05T10:22:46+00:00","breadcrumb":{"@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#primaryimage","url":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","contentUrl":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","width":1200,"height":496},{"@type":"BreadcrumbList","@id":"https:\/\/magecurious.com\/blog\/how-to-pre-select-default-payment-method-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/magecurious.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Pre Select Default Payment Method In Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/magecurious.com\/blog\/#website","url":"https:\/\/magecurious.com\/blog\/","name":"Magecurious","description":"Blog","publisher":{"@id":"https:\/\/magecurious.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/magecurious.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/magecurious.com\/blog\/#organization","name":"Magecurious","url":"https:\/\/magecurious.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/magecurious.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-New_Project.png","contentUrl":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-New_Project.png","width":596,"height":113,"caption":"Magecurious"},"image":{"@id":"https:\/\/magecurious.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/magecurious.com\/blog\/#\/schema\/person\/6bced7da0991e7fbbd4550006a6494e2","name":"Magecurious","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/magecurious.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c9178df2190b2309da97c9f28dd475bc338275cf664d12678d7e5da51c761271?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c9178df2190b2309da97c9f28dd475bc338275cf664d12678d7e5da51c761271?s=96&d=mm&r=g","caption":"Magecurious"},"sameAs":["https:\/\/magecurious.com"],"url":"https:\/\/magecurious.com\/blog\/author\/magecurious-wp\/"}]}},"jetpack_featured_media_url":"https:\/\/magecurious.com\/blog\/wp-content\/uploads\/2024\/04\/DEFAULT-PAYMENT-METHOD.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/posts\/1295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/comments?post=1295"}],"version-history":[{"count":0,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/posts\/1295\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/media\/1297"}],"wp:attachment":[{"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/media?parent=1295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/categories?post=1295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/magecurious.com\/blog\/wp-json\/wp\/v2\/tags?post=1295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}