由于有很多关于相同的问题,而且也已经验证了答案,但它不能解决我的问题,因为我想从结账页面中删除默认的检查,我将使用Amasty页面结帐任何帮助将不胜感激。谢谢
发布于 2022-01-07 02:35:45
覆盖:
vendor/magento/module-checkout/view/frontend/web/template/billing-address.html
在您的自定义主题中:
app/design/frontend///Magento_Checkout/web/template/billing-address.html
并删除:
<div class="billing-address-same-as-shipping-block field choice" data-bind="visible: canUseShippingAddress()">
<input type="checkbox" name="billing-address-same-as-shipping"
data-bind="checked: isAddressSameAsShipping, click: useShippingAddress, attr: {id: 'billing-address-same-as-shipping-' + getCode($parent)}"/>
<label data-bind="attr: {for: 'billing-address-same-as-shipping-' + getCode($parent)}"><span
data-bind="i18n: 'My billing and shipping address are the same'"></span></label>
</div>发布于 2022-08-12 10:35:02
我的Magento版本是2.4
而不是覆盖核心js文件,我使用Js密辛方式来实现输出,见下图。
创建Vendor\Module\view\frontend\web\js\view\checkout\billing-address-mixin.js的
define([
'jquery',
'ko',
'underscore',
'uiRegistry',
'Magento_Checkout/js/model/quote',
], function (
$,
ko,
_,
registry,
quote,
) {
'use strict';
var mixin = {
/**
* on change billing address set `isAddressSameAsShipping` variable as a "false" for display Edit Button below the Address
*
* see /Magento_Checkout/view/frontend/web/template/billing-address/details.html template file
*/
initObservable: function () {
var result = this._super();
quote.billingAddress.subscribe(function (newAddress) {
this.isAddressSameAsShipping(false);
}, this);
return result;
},
/**
* return false for hide the `My billing and shipping address are the same` checkbox
*
* see /Magento_Checkout/view/frontend/web/template/billing-address.html template file
*/
canUseShippingAddress: ko.computed(function () {
return false;
}),
}
return function (target) {
return target.extend(mixin);
};
});&然后创建Vendor\Module\view\frontend\requirejs-config.js
var config = {
config: {
mixins: {
'Magento_Checkout/js/view/billing-address': {
'Vendor_Module/js/view/checkout/billing-address-mixin': true
},
}
},
}输出:-

https://stackoverflow.com/questions/70418624
复制相似问题