{"id":25271,"date":"2022-01-13T03:50:27","date_gmt":"2022-01-13T08:50:27","guid":{"rendered":"https:\/\/plumrocket.com\/docs\/?p=25271"},"modified":"2024-10-14T12:33:31","modified_gmt":"2024-10-14T16:33:31","slug":"how-to-add-consent-checkboxes-manually-in-magento-2-gdpr","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually","title":{"rendered":"How to Add Consent Checkboxes Manually"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part of <a href=\"\/magento-gdpr\">Magento 2 GDPR<\/a>, <a href=\"\/magento-ccpa\">CCPA<\/a>, and <a href=\"\/magento-lgpd\">LGPD<\/a> extensions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are default locations that you can view in the Magento admin panel -&gt;Plumrocket -&gt; Data Privacy -&gt; <a href=\"\/docs\/magento-data-privacy\/v3\/configuration#consent-locations\">Consent Locations<\/a>. At the moment, 4 Magento checkbox locations are available: registration, checkout, newsletter subscription forms, and contact us form. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, the locations can be added by other Plumrocket extensions, or you can create your custom ones. Please follow this guide to learn how to create custom consent locations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-1-displaying-checkboxes-using-layout-containers\">Example 1. Displaying Checkboxes Using Layout Containers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If your page is built using containers, then you should use the code from the example below.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, we will add checkboxes on the Registration Page. Add a container to the XML layout file:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Open the file:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">\/frontend\/layout\/customer_account_create.xml<\/code><\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Add the code as shown below:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">&lt;referenceContainer name=&quot;form.additional.info&quot;&gt;\n    &lt;block name=&quot;data_privacy_checkbox&quot;\n        template=&quot;Plumrocket_DataPrivacy::x-init\/location_checkbox_list.phtml&quot;\n        ifconfig=&quot;prgdpr\/general\/enabled&quot;&gt;\n        &lt;arguments&gt;\n            &lt;argument name=&quot;locationKey&quot; xsi:type=&quot;string&quot;&gt;registration&lt;\/argument&gt;\n            &lt;argument name=&quot;scope&quot; xsi:type=&quot;string&quot;&gt;pr-data-privacy-registration&lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/block&gt;\n&lt;\/referenceContainer&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Where:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&#8220;<strong>locationKey<\/strong>&#8221; is a location identifier, which you can find in the <a href=\"\/docs\/magento-data-privacy\/v3\/configuration#consent-locations\">Consent Locations grid<\/a>.<\/li><li>&#8220;<strong>scope<\/strong>&#8221; is a unique identifier for each checkbox list.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-2-displaying-checkboxes-using-layout-blocks\">Example 2. Displaying Checkboxes Using Layout Blocks<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create layout blocks if you need to add checkboxes within HTML content. Use the code from the example below.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, we will add checkboxes to the Newsletter Subscription form.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-step-1-insert-block-into-the-page-xml-layout\">Step 1. Insert block into the page XML layout<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Open the file:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">\/frontend\/layout\/default.xml<\/code><\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Add the code as shown below:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">&lt;referenceBlock name=&quot;form.subscribe&quot;&gt;\n    &lt;block name=&quot;prgdpr_newsletter_checkbox&quot;\n        template=&quot;Plumrocket_DataPrivacy::x-init\/location_checkbox_list.phtml&quot;\n        ifconfig=&quot;prgdpr\/general\/enabled&quot;&gt;\n        &lt;arguments&gt;\n            &lt;argument name=&quot;locationKey&quot; xsi:type=&quot;string&quot;&gt;newsletter&lt;\/argument&gt;\n            &lt;argument name=&quot;scope&quot; xsi:type=&quot;string&quot;&gt;pr-data-privacy-newsletter&lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/block&gt;\n&lt;\/referenceBlock&gt;<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-step-2-insert-block-into-the-page-html-template\">Step 2. Insert block into the page HTML template<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Open the file:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">\/frontend\/templates\/subscribe.phtml<\/code><\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Add the highlighted code as shown below:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre data-line=\"10,11\"><code class=\"language-php\" data-line=\"\">&lt;div class=&quot;field newsletter&quot;&gt;\n    &lt;label class=&quot;label&quot; for=&quot;newsletter&quot;&gt;&lt;span&gt;\n        &lt;?= $block-&gt;escapeHtml(__(&#039;Sign Up for Our Newsletter:&#039;)) ?&gt;&lt;\/span&gt;&lt;\/label&gt;\n    &lt;div class=&quot;control&quot;&gt;\n        &lt;input name=&quot;email&quot; type=&quot;email&quot; id=&quot;newsletter&quot;\n            placeholder=&quot;&lt;?= $block-&gt;stripTags(__(&#039;Enter your email address&#039;)) ?&gt;&quot;\n            data-validate=&quot;{required:true, &#039;validate-email&#039;:true}&quot;\/&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;\n\n&lt;?= $block-&gt;getChildHtml(&#039;prgdpr_newsletter_checkbox&#039;) ?&gt;\n\n&lt;div class=&quot;actions&quot;&gt;\n    &lt;button class=&quot;action subscribe primary&quot;\n        title=&quot;&lt;?= $block-&gt;stripTags(__(&#039;Subscribe&#039;)) ?&gt;&quot; type=&quot;submit&quot;&gt;\n        &lt;span&gt;&lt;?= $block-&gt;escapeHtml(__(&#039;Subscribe&#039;)) ?&gt;&lt;\/span&gt;\n    &lt;\/button&gt;\n&lt;\/div&gt;<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-3-displaying-checkboxes-using-ui-components\">Example 3. Displaying Checkboxes Using UI Components<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If your page is based on UI Components, then you should use the code from the example below.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s try to add checkboxes on the Checkout Page. Add container and UI Component to the XML layout file:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Open the file:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">\/frontend\/layout\/checkout_index_index.xml<\/code><\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Add the code as shown below:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">&lt;referenceContainer name=&quot;content&quot;&gt;\n    &lt;block\n        class=&quot;MagentoFrameworkViewElementTemplate&quot;\n        name=&quot;prgdpr_checkbox&quot;\n        template=&quot;Plumrocket_GDPR::consent-checkboxes-jslayout.phtml&quot;\n    &gt;\n        &lt;arguments&gt;\n            &lt;argument name=&quot;prgdprPage&quot; xsi:type=&quot;string&quot;&gt;checkout&lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/block&gt;\n&lt;\/referenceContainer&gt;\n\n&lt;referenceBlock name=&quot;checkout.root&quot;&gt;\n    &lt;arguments&gt;\n        &lt;argument name=&quot;jsLayout&quot; xsi:type=&quot;array&quot;&gt;\n            &lt;item name=&quot;components&quot; xsi:type=&quot;array&quot;&gt;\n                &lt;item name=&quot;checkout&quot; xsi:type=&quot;array&quot;&gt;\n                    &lt;item name=&quot;children&quot; xsi:type=&quot;array&quot;&gt;\n                        &lt;item name=&quot;steps&quot; xsi:type=&quot;array&quot;&gt;\n                            &lt;item name=&quot;children&quot; xsi:type=&quot;array&quot;&gt;\n                                &lt;item name=&quot;billing-step&quot; xsi:type=&quot;array&quot;&gt;\n                                    &lt;item name=&quot;children&quot; xsi:type=&quot;array&quot;&gt;\n                                        &lt;item name=&quot;payment&quot; xsi:type=&quot;array&quot;&gt;\n                                            &lt;item\n                                                name=&quot;children&quot;\n                                                xsi:type=&quot;array&quot;\n                                            &gt;\n                                                &lt;item\n                                                    name=&quot;payments-list&quot;\n                                                    xsi:type=&quot;array&quot;\n                                                &gt;\n                                                    &lt;item\n                                                        name=&quot;children&quot;\n                                                        xsi:type=&quot;array&quot;\n                                                    &gt;\n                                                        &lt;item\n                                                            name=&quot;before-place-order&quot;\n                                                            xsi:type=&quot;array&quot;\n                                                        &gt;\n                                                            &lt;item\n                                                                name=&quot;children&quot;\n                                                                xsi:type=&quot;array&quot;\n                                                            &gt;\n                                                                &lt;item\n                                                                    name=&quot;prgdpr-consent-checkboxes&quot;\n                                                                    xsi:type=&quot;array&quot;\n                                                                &gt;\n                                                                    &lt;item\n                                                                        name=&quot;component&quot;\n                                                                        xsi:type=&quot;string&quot;\n                                                                        &gt;Plumrocket_GDPR\/js\/view\/consent-checkbox&lt;\/item\n                                                                    &gt;\n                                                                    &lt;item\n                                                                        name=&quot;sortOrder&quot;\n                                                                        xsi:type=&quot;string&quot;\n                                                                        &gt;200&lt;\/item\n                                                                    &gt;\n                                                                    &lt;item\n                                                                        name=&quot;displayArea&quot;\n                                                                        xsi:type=&quot;string&quot;\n                                                                        &gt;before-place-order&lt;\/item\n                                                                    &gt;\n                                                                    &lt;item\n                                                                        name=&quot;dataScope&quot;\n                                                                        xsi:type=&quot;string&quot;\n                                                                        &gt;prgdprConsent&lt;\/item\n                                                                    &gt;\n                                                                    &lt;item\n                                                                        name=&quot;provider&quot;\n                                                                        xsi:type=&quot;string&quot;\n                                                                        &gt;prgdprConsentProvider&lt;\/item\n                                                                    &gt;\n                                                                &lt;\/item&gt;\n                                                            &lt;\/item&gt;\n                                                        &lt;\/item&gt;\n                                                    &lt;\/item&gt;\n                                                &lt;\/item&gt;\n                                            &lt;\/item&gt;\n                                        &lt;\/item&gt;\n                                    &lt;\/item&gt;\n                                &lt;\/item&gt;\n                            &lt;\/item&gt;\n                        &lt;\/item&gt;\n                    &lt;\/item&gt;\n                &lt;\/item&gt;\n            &lt;\/item&gt;\n        &lt;\/argument&gt;\n    &lt;\/arguments&gt;\n&lt;\/referenceBlock&gt;\n    <\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part of Magento 2 GDPR, CCPA, and LGPD extensions. There are default locations that you can view in the Magento admin panel -&gt;Plumrocket -&gt; Data Privacy &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Add Consent Checkboxes Manually&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[342],"tags":[],"class_list":["post-25271","post","type-post","status-publish","format-standard","hentry","category-magento-gdpr-v3-devguide","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v28.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Add Consent Checkboxes Manually - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add Consent Checkboxes Manually\" \/>\n<meta property=\"og:description\" content=\"In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-13T08:50:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-14T16:33:31+00:00\" \/>\n<meta name=\"author\" content=\"Plumrocket\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Add Consent Checkboxes Manually - Plumrocket Documentation","description":"In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually","og_locale":"en_US","og_type":"article","og_title":"How to Add Consent Checkboxes Manually","og_description":"In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part","og_url":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually","og_site_name":"Plumrocket Documentation","article_published_time":"2022-01-13T08:50:27+00:00","article_modified_time":"2024-10-14T16:33:31+00:00","author":"Plumrocket","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually#article","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually"},"author":{"name":"Plumrocket","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8"},"headline":"How to Add Consent Checkboxes Manually","datePublished":"2022-01-13T08:50:27+00:00","dateModified":"2024-10-14T16:33:31+00:00","mainEntityOfPage":{"@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually"},"wordCount":313,"articleSection":["Developer Guide"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually","url":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually","name":"How to Add Consent Checkboxes Manually - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"datePublished":"2022-01-13T08:50:27+00:00","dateModified":"2024-10-14T16:33:31+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8"},"description":"In this guide, you can learn how to manually place checkboxes in the needed location of the page with the help of the Data Privacy module, which is a part","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3\/devguide\/add-checkboxes-manually#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/magento-extensions"},{"@type":"ListItem","position":2,"name":"Magento 2 GDPR","item":"https:\/\/plumrocket.com\/magento-gdpr"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-data-privacy"},{"@type":"ListItem","position":4,"name":"v3","item":"https:\/\/plumrocket.com\/docs\/magento-data-privacy\/v3"},{"@type":"ListItem","position":5,"name":"Developer Guide","item":"https:\/\/plumrocket.com\/docs\/magento-gdpr\/v3\/devguide"},{"@type":"ListItem","position":6,"name":"How to Add Consent Checkboxes Manually"}]},{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8","name":"Plumrocket","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","caption":"Plumrocket"}}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/25271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=25271"}],"version-history":[{"count":5,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/25271\/revisions"}],"predecessor-version":[{"id":25842,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/25271\/revisions\/25842"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=25271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=25271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=25271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}