The correct option is A I was wondering
Option C: 'I was wondering' in the context of this sentence means: 'I hope that you had the last part of Harry Potter' or 'I would like it if you had the last part...'
So, 'I was wondering' is a continuous action in regard to the current event.
In this sense, 'I was wondering' is considered as a polite request for the book of Harry Potter, rather than a past continuous action.
Hence option C is correct.
Option A: 'I had heard' refers to an action that happened in the past. But, the clause "if you had the last part..." is a conditional. It presents an unreal situation that may or may not be true. Hence A is incorrect.
Option B: 'Can you find out' is in the simple present whereas 'if you had...' is a conditional in the past tense. It does not agree with the verb 'had', as it means this:
The person wants to know if the bookstore had the last part of Harry Potter. He wanted to know if they had it earlier, he does not want to know about the present.
This meaning does not sound clear, considering the rest of the conversation that follows. Hence B is incorrect.
Option D: Similarly, 'Do you know' also does not agree with the if-clause.
Also, 'do you know' forms a question, but the given sentence does not end with a question mark '?'.
Hence D is incorrect.