title: Woocommerce: Save all products by X times a day
body: <p>I have this code which update all products. It works fine. But I need to change it.</p>
  
  <pre><code>    add_action( 'wp', 'update_products_by_x' );
  function update_products_by_x(){
  
      $limit = 200;
  
      // getting all products
      $products_ids = get_posts( array(
          'post_type'        =&gt; 'product', // or ['product','product_variation'],
          'numberposts'      =&gt; $limit,
          'post_status'      =&gt; 'publish',
          'fields'           =&gt; 'ids',
          'meta_query'       =&gt; array( array(
              'key'     =&gt; '_sync_updated',
              'compare' =&gt; 'NOT EXISTS',
          ) )
      ) );
  
      // Loop through product Ids
      foreach ( $products_ids as $product_id ) {
  
          // Get the WC_Product object
          $product = wc_get_product($product_id);
  
          // Mark product as updated
          $product-&gt;update_meta_data( '_sync_updated', true );
  
          $product-&gt;save();
      }
  }
  </code></pre>
  
  <p>The function above marks the updated products as 'updated'. Then this code will save all the products just one time. </p>
  
  <p><strong>Question:</strong> How do change this function so that I get all products saved every time the function is executed and not just one time.</p>