I am needing to alter the way the checkout process works on a Magento 2 site because the site offers quotes only and therefore I do not want any mention of the term "Checkout" in the traditional sense. So basically I am trying to either alter what is displayed in the default checkout popup (screenshot below) or show different content altogether. enter image description here

I have been searching for a module/extension to achieve the results I am looking for but I have found nothing.

It has also been suggested that I remove everything within the click function in the login-popup.js (see code below) and add this:

window.location.href = '/customer/account/login'

Can anyone explain exactly what and where I need to replace this in the code below?

define(
[
'jquery',
'Magento_Customer/js/model/authentication-popup',
'mage/url',
'mage/cookies'
],
function ($, authenticationPopup, url) {
'use strict';

return function (config, element) {
$(element).click(function (event) {
var date = new Date();
date.setTime(date.getTime() + 420000);
event.preventDefault();
$.cookie('login_redirect', url.build('quotation/quote'), {expires: date});
authenticationPopup.showModal();
return false;
});
};
}
);

Any other ideas or direction on how to change the content of the default popup would be greatly appreciated also.

I hope this makes sense.

Thank you, Rob

有帮助吗?

解决方案

This file is located at vendor/magento-customer/view/frontend/web/template/authentication-popup.html

You can copy the file to your custom theme and make changes to text or html that you require - you would locate it in the following path: app/design/frontend/VENDOR/THEME/Magento_Customer/web/template/authentication-popup.html and Magento will find your file and use it instead.

Unless you need to change some other functionality, you shouldn't need to override the js file.

It might also be possible to use the translation system, if all you need to do is change the text "Checkout". It will change "Checkout" to whatever you specify, wherever it appears. https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/translations/xlate.html

许可以下: CC-BY-SA归因
scroll top