Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • I’ve proposed 2 options, first option requires patching, the second does not. Adding #2 solution to your functions.php will allow you to update the plugin.

    Unfortunately current implementation does not have any easy way to address this issue, but here is two work arounds:

    1. You can patch the plugin (make change in the plugin). Unfortunately changes will be lost if you will update the plugin.

    To patch the plugin
    1. Open omnisend-connect/omnisend-woocommerce-hooks.php.
    2. Scroll to line 215, you should see the following if statement:
    if (OmnisendHelper::isWooCommercePluginActivated() && OmnisendHelper::checkWpWcCompatibility() ) {
    3. Add additional check accordingly to your needs, e.g. :
    if (OmnisendHelper::isWooCommercePluginActivated() && OmnisendHelper::checkWpWcCompatibility() && isset( $_COOKIE[ 'my_cookie' ] ) ) {

    -OR-

    2. You can add a following function to your functions.php in your theme/child theme:

    function load_omnisend_with_consent( $value, $option ) {
    	if ( ! isset( $_COOKIE[ 'my_cookie' ] ) ) {
    		return null;
    	}
    
    	return $value;
    }
    add_filter( 'option_omnisend_account_id', 'load_omnisend_with_consent', 10, 2 );

    Ideally a ‘wp_footer’ action should be not be set up as anonymous action, so other plugins would have a chance to remove / modify the behaviour.

    NOTE: Your site user will have to reload the page (if its not done automatically after accepting cookies) for Omnisend JS snippet to be loaded.

    • This reply was modified 3 years, 7 months ago by mb00.
    • This reply was modified 3 years, 7 months ago by mb00. Reason: Added a note
Viewing 2 replies - 16 through 17 (of 17 total)