• Resolved kw11

    (@kw11)


    Hello,

    Your resync feature doesn’t work right if I delete all customers/orders. This is because your cron schedule isn’t initializing

    Please have your developers replace the cron schedule code in omnisend-woocommerce.php with this.

    add_action( 'wp_loaded', function() {
    add_filter( 'cron_schedules', function( $schedules ) {
    $schedules['two_minutes'] = array(
    'interval' => 60 * 2,
    'display' => __( 'Every 2 minutes', 'omnisend-woocommerce' ),
    );
    return $schedules;
    });
    });

    Cron schedules should be initiated after wp_loaded. This code will fix the problem.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kw11

    (@kw11)

    I also wanted to suggest being able to sync wordpress/woocommerce custom fields or tags from WordPress to Omnisend. So far, I’ve looked at how your plugin does tags and this shouldn’t be too hard for contacts.

    Just a simple settings page to select the wordpress custom fields that will correspond to tags, etc. for users. Then you add a couple lines of code in class-omnisend-contact.php so these tags are automatically synced to contacts.

    You’ll really stand out from the competition if you add some basic features that allow users to segment any way they want.

    • This reply was modified 1 year, 11 months ago by kw11.
    Thread Starter kw11

    (@kw11)

    Sorry, might be more appropriate to use init(), but both will work. This also doesn’t change your function names or overall structure.

    Use this instead if desired.

    /*Add a custom cron schedule for every 2 minutes*/
    function omnisend_2min_cron($schedules) {
        $schedules['two_minutes'] = array(
            'interval' => 60 * 2,
            'display' => __('Every 2 minutes', 'omnisend-woocommerce')
        );
        return $schedules;
    }
    
    /*Initialize the custom cron schedule on init*/
    function omnisend_initialize_cron_schedule() {
        add_filter('cron_schedules', 'omnisend_2min_cron');
    }
    • This reply was modified 1 year, 11 months ago by kw11.
    Thread Starter kw11

    (@kw11)

    Wish I could edit threads for longer. I missed a line of code. And this new block editor commenting system gives me problems. Here it is again.

    /*Add a custom cron schedule for every 2 minutes*/
    function omnisend_2min_cron($schedules) {
        $schedules['two_minutes'] = array(
            'interval' => 60 * 2,
            'display' => __('Every 2 minutes', 'omnisend-woocommerce')
        );
        return $schedules;
    }
    
    /*Initialize the custom cron schedule on init*/
    function omnisend_initialize_cron_schedule() {
        add_filter('cron_schedules', 'omnisend_2min_cron');
    }
    add_action('init', 'omnisend_initialize_cron_schedule');
    • This reply was modified 1 year, 11 months ago by kw11.

    Why don’t you contact their support? They can connect you with their dev team.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Broken resync code fix’ is closed to new replies.