An extension is created in SC standard where a checkbox is displayed and checked by default for email subscription
//Create an extension with js and template. You need to override the checkout as guest template, we have used _.extend method. However, you can use methods provided by extensiblity API
define(
'JobinAndJismiITServices.SubscribeInCheckout.CheckoutAsGuest', [
'LoginRegister.CheckoutAsGuest.View', 'jobinandjismiitservices_subscribeincheckout_checkoutasguest.tpl', 'Utils', 'Backbone', 'jQuery', 'underscore'
],
function(
LoginRegisterCheckoutAsGuestView, CheckoutAsGuestViewTPL, Utils, Backbone, jQuery, _
) {
'use strict';
return {
mountToApp: function mountToApp(container) {
// using the 'Layout' component we add a new child view inside the 'Header' existing view
// (there will be a DOM element with the HTML attribute data-view="Header.Logo")
// more documentation of the Extensibility API in
// https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/index.html
/** @type {LayoutComponent} */
_.extend(LoginRegisterCheckoutAsGuestView.prototype, {
template: CheckoutAsGuestViewTPL
});
}
};
});
Add the below HTML code to the template and SCA will check the email subscription by default
<div class="login-register-register-form-controls-group">
<label class="login-register-register-form-label checkbox-container">
<input type="checkbox" name="emailsubscribe" id="register-emailsubscribe" value="T" checked="checked">
<span class="checkmark"></span>
Keep me up to date on news and exclusive offers
</label>
</div>
