diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index a182accb766..8b110f52805 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -1078,14 +1078,12 @@ class WC_API_Products extends WC_API_Resource { // Download limit if ( isset( $data['download_limit'] ) ) { - $download_limit = absint( $data['download_limit'] ); - update_post_meta( $id, '_download_limit', ( ! $download_limit ) ? '' : $download_limit ); + update_post_meta( $id, '_download_limit', ( '' === $data['download_limit'] ) ? '' : absint( $data['download_limit'] ) ); } // Download expiry if ( isset( $data['download_expiry'] ) ) { - $download_expiry = absint( $data['download_expiry'] ); - update_post_meta( $id, '_download_expiry', ( ! $download_expiry ) ? '' : $download_expiry ); + update_post_meta( $id, '_download_expiry', ( '' === $data['download_expiry'] ) ? '' : absint( $data['download_expiry'] ) ); } // Download type