Plumrocket US Privacy Laws extension automatically adds the “Do Not Sell or Share My Personal Information” link to the store’s footer. However, due to different footer implementations in the Magento themes, it may not always work correctly.
In cases when the link doesn’t display automatically, or if you need full control over its position, you can add it manually.
In this article, we will consider two ways to add the “Do Not Sell or Share My Personal Information” link manually:
Add the link using the .phtml theme template
This method allows for generating this link dynamically using PHP and Magento layout systems. Such an approach is recommended if you want to automatically substitute the link name (label) and path specified in the extension settings.
<?= $block->getLayout()
->createBlock(
\Plumrocket\CCPA\Block\CcpaLink::class,
'pr.ccpa.link.created.in.template',
['data' => [
'label' => $this->helper(\Plumrocket\CCPA\Helper\Config\DoNotSellConfig::class)->getFooterLinkLabel(),
'path' => $this->helper(\Plumrocket\CCPA\Helper\Config::class)->getCcpaCmsPageIdentifier(),
]]
)
->toHtml();
?>
Step-by-step guide:
- Open your theme’s footer template: footer.phtml (or other appropriate file, depending on the structure of the theme)
- Insert the code mentioned above in the needed place
- Flush the Magento cache:
bin/magento cache:flush
- Check the results on the frontend
Add the link using the CMS block
This option should be used when the store’s footer is being formed via CMS blocks. This could be a customization result or standard behavior of specific themes (for example, Hyvä). In this case, you should edit the corresponding CMS blocks manually.
Important Information:
You can’t dynamically read the link name and path. The label and path parameters should be specified manually
{{block class="Plumrocket\CCPA\Block\CcpaLink" name="pr-ccpa-link" label="Do Not Sell or Share My Personal Information" path="do-not-sell-or-share-my-personal-information"}}
Step-by-step guide:
- Go to Content -> Blocks in your Magento admin panel.
- Find the CMS block that is used by your theme for the footer formation on the frontend.
- Edit this block and add the code mentioned above to the needed place.
- Save the changes and make sure that the block is displayed correctly on the page.
- Flush the Magento cache:
bin/magento cache:flush
Conclusions
Plumrocket US Privacy Laws extension tries to insert the “Do Not Sell or Share My Personal Information” in the footer automatically. However, depending on the theme you use, additional manual changes may be required.
You should use the CMS block method if you need to display the link in the footer, which is formed via CMS blocks (which often happens in modern themes such as Hyvä).
If the footer is implemented in the .phtml template, it is more appropriate to use insertion through a template to dynamically display the link name and path.