Developer forum

Forum » Ecommerce - Standard features » Use email subscription in checkout

Use email subscription in checkout

Caro De Weze
Reply

Hi,

When I enable 'Use email subscription' at checkout, nothing appears on the frontend. I would like a newsletter subscribe checkbox to appear in the checkout for logged in users. Is this not the correct setting or does something else need to be done for this?

Kind regards,
Caro De Weze

Screenshot_2024-05-08_at_08.51.12.png

Replies

 
Kim Brøgger Hansen Dynamicweb Employee
Kim Brøgger Hansen
Reply
This post has been marked as an answer

Hi Caro,

The setting controls if the Email permission on users are set when making an order.

In Swift you will be able to use this setting in the frontend on Anonymous users only (but can be added to logged in users as well)

Votes for this answer: 1
 
Caro De Weze
Reply

Hi Kim,

I got it working by copying this piece of code from the template AddressDeliveryAnonymous_v2.cshtml to template AddressUser_V2_cshtml: 
            @* Use newsletter *@
            @if (GetString("Ecom:Cart.UseNewsletterSubscription") == "True")
            {
                bool? isChecked = null;
                if (GetString("Ecom:Order.Customer.NewsletterSubscribe") == "true")
                {
                    isChecked = true;
                }

                <div class="g-col-12">
                    <div class="form-check">
                        <input class="form-check-input" type="checkbox" name="EcomOrderSubscribeToNewsletter" id="EcomOrderSubscribeToNewsletter" checked="@isChecked" onchange="toggleCreateUser(event);">
                        <label class="form-check-label lh-1" for="EcomOrderSubscribeToNewsletter">
                            <span>@Translate("Keep me updated with deals, news and offers")</span>
                        </label>
                    </div>
                </div>
            }

Thanks for the assistance.

Kind regards,
Caro De Weze

 

You must be logged in to post in the forum