How to override or extend proceed-to-checkout.jsExtending / Overriding JS in Magento 2Extend or override blanks theme jsHow Are the Things Magento 2 calls “mixins” Implemented?How to override Magento 2 js using Mixins?How to override price-utils.js specific method?Magento 2.2.5: How to validate shipping addressExtend a default JS component or Use Mixinhow to override Proceed to Checkout button in cart page in Magento 2Magento_Payment/translate not included in requirejs config for mixinsHow to extend admin js in magento 2 by mixins
How can I tell the difference between unmarked sugar and stevia?
Passing multiple files through stdin (over ssh)
Why doesn't Adrian Toomes give up Spider-Man's identity?
Overlapping String-Blocks
Should an arbiter claim draw at a K+R vs K+R endgame?
What can I, as a user, do about offensive reviews in App Store?
1980s live-action movie where individually-coloured nations on clouds fight
Do simulator games use a realistic trajectory to get into orbit?
What language is software running on the ISS written in?
What is the highest possible temporary AC at level 1, without any help from others?
Recommended tools for graphs and charts
Mathematically, why does mass matrix / load vector lumping work?
How to return a security deposit to a tenant
C++ Arduino IDE receiving garbled `char` from function
Soft question: Examples where lack of mathematical rigour cause security breaches?
How can I get an unreasonable manager to approve time off?
Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?
Why would future John risk sending back a T-800 to save his younger self?
What is wrong with this proof that symmetric matrices commute?
Determining fair price for profitable mobile app business
Someone whose aspirations exceed abilities or means
Compiling C files on Ubuntu and using the executable on Windows
How to hide an urban landmark?
Why was the Sega Genesis marketed as a 16-bit console?
How to override or extend proceed-to-checkout.js
Extending / Overriding JS in Magento 2Extend or override blanks theme jsHow Are the Things Magento 2 calls “mixins” Implemented?How to override Magento 2 js using Mixins?How to override price-utils.js specific method?Magento 2.2.5: How to validate shipping addressExtend a default JS component or Use Mixinhow to override Proceed to Checkout button in cart page in Magento 2Magento_Payment/translate not included in requirejs config for mixinsHow to extend admin js in magento 2 by mixins
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to override or extend Magento's proceed-to-checkout.js
file in my module.
app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
In my modules requirejs-config.js I have tried using a mixin and also replacing the mapping with both...
var config =
'config':
'mixins':
'Magento_Checkout/js/proceed-to-checkout':
'Mynamespace_Checkout/js/view/proceed-to-checkout-mixin': true
;
AND
var config =
map:
'*':
proceedToCheckout: 'Mynamespace_Checkout/js/proceed-to-checkout'
;
Neither work and I'm unsure how I should write the mixin as Magento's original proceed-to-checkout.js file simply returns an anonymous function with a jQuery click event listener.
Any idea how I can get this to work in a module?
checkout javascript mixins
add a comment |
I need to override or extend Magento's proceed-to-checkout.js
file in my module.
app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
In my modules requirejs-config.js I have tried using a mixin and also replacing the mapping with both...
var config =
'config':
'mixins':
'Magento_Checkout/js/proceed-to-checkout':
'Mynamespace_Checkout/js/view/proceed-to-checkout-mixin': true
;
AND
var config =
map:
'*':
proceedToCheckout: 'Mynamespace_Checkout/js/proceed-to-checkout'
;
Neither work and I'm unsure how I should write the mixin as Magento's original proceed-to-checkout.js file simply returns an anonymous function with a jQuery click event listener.
Any idea how I can get this to work in a module?
checkout javascript mixins
add a comment |
I need to override or extend Magento's proceed-to-checkout.js
file in my module.
app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
In my modules requirejs-config.js I have tried using a mixin and also replacing the mapping with both...
var config =
'config':
'mixins':
'Magento_Checkout/js/proceed-to-checkout':
'Mynamespace_Checkout/js/view/proceed-to-checkout-mixin': true
;
AND
var config =
map:
'*':
proceedToCheckout: 'Mynamespace_Checkout/js/proceed-to-checkout'
;
Neither work and I'm unsure how I should write the mixin as Magento's original proceed-to-checkout.js file simply returns an anonymous function with a jQuery click event listener.
Any idea how I can get this to work in a module?
checkout javascript mixins
I need to override or extend Magento's proceed-to-checkout.js
file in my module.
app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
In my modules requirejs-config.js I have tried using a mixin and also replacing the mapping with both...
var config =
'config':
'mixins':
'Magento_Checkout/js/proceed-to-checkout':
'Mynamespace_Checkout/js/view/proceed-to-checkout-mixin': true
;
AND
var config =
map:
'*':
proceedToCheckout: 'Mynamespace_Checkout/js/proceed-to-checkout'
;
Neither work and I'm unsure how I should write the mixin as Magento's original proceed-to-checkout.js file simply returns an anonymous function with a jQuery click event listener.
Any idea how I can get this to work in a module?
checkout javascript mixins
checkout javascript mixins
asked May 30 at 11:40
HollyHolly
2,35933782
2,35933782
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config =
map:
'*':
"Magento_Checkout/js/proceed-to-checkout": 'SR_MagentoCommunity/js/proceed-to-checkout'
;
app/code/SR/MagentoCommunity/view/frontend/web/js/proceed-to-checkout.js
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData)
'use strict';
return function (config, element)
console.log('new');
$(element).click(function (event)
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false)
authenticationPopup.showModal();
return false;
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
);
;
);
Clear static content if you are not in developer mode.
Perfect, thanks!
– Holly
May 30 at 12:49
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f276727%2fhow-to-override-or-extend-proceed-to-checkout-js%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
Try following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config =
map:
'*':
"Magento_Checkout/js/proceed-to-checkout": 'SR_MagentoCommunity/js/proceed-to-checkout'
;
app/code/SR/MagentoCommunity/view/frontend/web/js/proceed-to-checkout.js
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData)
'use strict';
return function (config, element)
console.log('new');
$(element).click(function (event)
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false)
authenticationPopup.showModal();
return false;
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
);
;
);
Clear static content if you are not in developer mode.
Perfect, thanks!
– Holly
May 30 at 12:49
add a comment |
Try following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config =
map:
'*':
"Magento_Checkout/js/proceed-to-checkout": 'SR_MagentoCommunity/js/proceed-to-checkout'
;
app/code/SR/MagentoCommunity/view/frontend/web/js/proceed-to-checkout.js
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData)
'use strict';
return function (config, element)
console.log('new');
$(element).click(function (event)
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false)
authenticationPopup.showModal();
return false;
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
);
;
);
Clear static content if you are not in developer mode.
Perfect, thanks!
– Holly
May 30 at 12:49
add a comment |
Try following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config =
map:
'*':
"Magento_Checkout/js/proceed-to-checkout": 'SR_MagentoCommunity/js/proceed-to-checkout'
;
app/code/SR/MagentoCommunity/view/frontend/web/js/proceed-to-checkout.js
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData)
'use strict';
return function (config, element)
console.log('new');
$(element).click(function (event)
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false)
authenticationPopup.showModal();
return false;
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
);
;
);
Clear static content if you are not in developer mode.
Try following way:
app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js
var config =
map:
'*':
"Magento_Checkout/js/proceed-to-checkout": 'SR_MagentoCommunity/js/proceed-to-checkout'
;
app/code/SR/MagentoCommunity/view/frontend/web/js/proceed-to-checkout.js
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData)
'use strict';
return function (config, element)
console.log('new');
$(element).click(function (event)
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false)
authenticationPopup.showModal();
return false;
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
);
;
);
Clear static content if you are not in developer mode.
answered May 30 at 12:40
Sohel RanaSohel Rana
24.3k34664
24.3k34664
Perfect, thanks!
– Holly
May 30 at 12:49
add a comment |
Perfect, thanks!
– Holly
May 30 at 12:49
Perfect, thanks!
– Holly
May 30 at 12:49
Perfect, thanks!
– Holly
May 30 at 12:49
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f276727%2fhow-to-override-or-extend-proceed-to-checkout-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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