Support

Account

Home Forums Add-ons Repeater Field Delete repeater`s sub_field after expired date Reply To: Delete repeater`s sub_field after expired date

  • Thank you for information, i have more questions now:
    How i can querry and loop over all woocommerce products in functions.php?

    I created cronjob, made it run one time per day:

    
    add_action( 'triname_datas', 'triname_datas_func' );
    function triname_datas_func() {
      $today = date('Y-m-d');
      $repeater = get_field('pasirinkti_datas');
    // $repeater is an array of rows
    $count = count($repeater);
    for ($row=$count; $row>0; $row--) {
      if (get_sub_field('keliones_datos', $repeater) >= $today) {
        delete_row('pasirinkti_datas', $row);
      }
    }
    }
    

    But it is not working, i need to query and loop through products.