Autoload Ocean Popup Login on WooCommerce Checkout Page

This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

If you would like to enable auto load of Ocean Popup Login on the WooCommerce checkout page (for logged out users), use the following PHP/JS snippet:

/**
* Autoload login popup on checkout page
*/
add_action('wp_footer','add_js_functions');

function add_js_functions() {
if ( ! is_user_logged_in() && is_checkout() ) : ?>
<script>
(function($) {
$(document).ready(function() {
var loginForm = $( '#opl-login-form' );
// Show form
loginForm.fadeIn();
$('.opl-login-container .opl-login-content').css('opacity', '1');
});
})(jQuery);
</script>
<?php endif;
}

Code snippet provided by Roland Riddel.

All PHP snippets should be added via a child theme's functions.php file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.