Miva Merchant Modules and Development
Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.

COOKIES: Cookie Consent Message and Button and JS

Scot Ranney • March 07, 2024


Make a readytheme content section with the code cookie_privacy_message

<style>
#cookie-message {
   position: fixed;
   bottom: 0;
   width: 100%;
   z-index:2000;
}
</style>
<mvt:if expr="NOT g.request_cookies:cookieconsent">
   <div id="cookie-message" class="o-layout o-layout--justify-around u-bg-gray-50 u-text-gray-10" style="padding: 3% 8%; font-weight:700; width:105%!important">
	  <div class="u-width-12 u-width-8--m  u-color-gray-30">
		 By continuing to browse, you accept our use of cookies as explained in our <a href="/privacy-policy.html" target="_self">Privacy Policy</a>.<p></p>
	  </div>
	  <div class="u-width-12 u-width-4--m u-text-center" style="display:flex; align-items:center;justify-content: center">
		 <button id="cookie-set" class="c-button  u-bg-blue u-color-white  u-font-small u-text-uppercase">Click Here to Accept Cookies</button>
	  </div>
   </div>
<script>
   <mvt:assign name="l.settings:sdyntime" value="s.dyn_time_t" />
   $("#cookie-set").click(function(){
	  var name = 'cookieconsent';
	  var value = '&mvt:sdyntime';
	  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) +  "; path=/";
	  $('#cookie-message').fadeOut();
   });	
</script>
</mvt:if>

Put this near the bottom of the global footer:

<mvt:comment>
#
# cookie message - can be edited in the readytheme content section area
#
</mvt:comment>
<mvt:item name="readytheme" param="contentsection( 'cookie_privacy_message' )" />

https://www.scotsscripts.com/mvblog/cookies-cookie-consent-message-and-button-and-js.html

mvkb_cookies mvkb_js