24V optocoupler with 12V?
I checked the amazon link that you shared. Below is the product image:

R1 seems to be Brown Green Red Gold resistor which is a 1.5K resistor.
PC817 should work just fine as it is without any change to the circuit. If you face any challenge, try using a lower resistor value for R1. 680 Ohms should do the job.
EDIT:
OP confirmed that resistor is Brown Black Red Gold. It gives a value of 1K. Answer remains same. It should work well.