• Resolved streamworksaudio

    (@streamworksaudio)


    Hi,

    I am trying to add some download permissions to all previous orders via a script to do them in batch. The script seems to work fine expect for one thing. Here is the script…

    function update_download_permissions(){
    
      $orders = get_posts( array(
        'post_type'      => 'shop_order',
        'post_status'    => 'wc-completed',
        'posts_per_page' => -1
      ) );
    
      foreach ( $orders as $order ) {
        wc_downloadable_product_permissions( $order->ID, force );
      }
    
    }

    The problem is the wc_downloadable_product_permissions function is producing duplicate entries in the wp_woocommerce_downloadable_product_permissions table.

    Does anybody have any ideas as to why duplicate download permissions are being set?

    Cheers!

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Duplicate Download Permissions being set’ is closed to new replies.