• Resolved NF Graphic Design

    (@nf-graphic-design)


    I know this code to adjust the sync interval is posted in the WooCommerce Square FAQ. But posting this in my functions.php did not change it from an hourly sync. Is this outdated code they have posted, or am I missing something?

    Any help would be greatly appreciated.Thanks in advance

    
    // sync every 15 minutes instead of every hour
    add_filter( 'wc_square_sync_interval', function( $interval ) {
        return 15 * MINUTE_IN_SECONDS;
    } );
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    I’ve just had a look at the underlying code for Square in woocommerce-square/includes/Handlers/Sync.php/ (Line 99) and the filter is still available.

    As for why that’s not happening, where exactly are you looking for the sync rate CRON? Are you using a plugin https://www.ads-software.com/plugins/wp-crontrol/?

    Also are you seeing any PHP warnings/errors in the code for your functions.php file?

    Thread Starter NF Graphic Design

    (@nf-graphic-design)

    Hi, thanks for the reply!

    I was looking at WooCommerce – Settings – Square – Update where it says latest sync and next sync. It always showed next sync is in an hour.

    Are you thinking that this info would not be accurate? I would have hoped if I changed the interval it would tell me accurately the next scheduled sync would be in 30 min or whatever it is set to.

    I will give crontrol a look. Not seeing any PHP warnings, it was as if the code was doing nothing.

    I’ve been testing this too and can confirm the filter doesn’t work. According to WP Crontrol the only cron job with ‘square’ in the name, wc_square_background_sync_cron_interval, is always set to 5 minutes.

    I’m also testing your competitor, WooCommerce iZettle Integration, which syncs inventory every minute for a small price – this is what I’d expect to be able to do with this plugin, the supposed default of 1 hour is nowhere near frequent enough.

    So the documentation is just out of date, to change the interval amend your code like so:

    // Sync every minute
    add_filter('wc_square_background_sync_cron_interval', function($interval) {
        return 1;
    });
    Thread Starter NF Graphic Design

    (@nf-graphic-design)

    Thanks for your update, it’s awesome to see some activity on this. I do see the cron job under cron events reflecting the new interval. I had hoped that it would also have changed the timing to reflect this in WooCommerce settings – square – updated change to the sync timing. But it still only shows the next sync is every hour there. So while this seems to check more frequently now, will it actually update stock levels more frequently or still every hour?

    Has anyone made any progress on this? Clearly the Woocommerce/Square docs are wrong, as ‘wc_square_sync_interval’ doesn’t do anything. I’ve achieved the same results as @nf-graphic-design, changing ‘wc_square_background_sync_cron_interval’ and am able to see the updated time in wp-crontrol, but the actual sync still remains at an hour.

    Plugin Support Aashik P – a11n

    (@aashik)

    Hi there!

    Thank you all for reporting this here.

    We’ve updated the Can I change how often the automatic sync runs? section of the Square document to reflect the correct procedure to update the sync interval.

    Can you please try the same and let us know if you’re still having trouble with it?

    Thank you for working with us on this.

    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    I’m afraid I stopped testing this a while ago as found a good iZettle solution to work with. If your responses had been quicker I may have persevered.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to change sync interval’ is closed to new replies.