Sofia has forgotten the passcode of her phone. She only remembers that it has four digits and that the product of its digits is $18$. How many passcodes satisfy these conditions?
To solve the problem, we need to find the number of four-digit passcodes where the product of the digits is 18. Let's denote the digits by \(a, b, c,\) and \(d\). Therefore, we need to find the number of solutions to the equation:

\[ a \cdot b \cdot c \cdot d = 18 \]

where \(a, b, c,\) and \(d\) are digits from 1 to 9.

1. **Factorize 18**:
   \[
   18 = 2 \times 3^2
   \]
   The prime factorization of 18 is \(2 \times 3 \times 3\).

2. **Distribute the factors among the digits**:
   We need to distribute the factors \(2, 3, 3\) among the four digits \(a, b, c,\) and \(d\). Note that each digit can be 1, which does not change the product.

3. **Use stars and bars method**:
   We need to distribute the two 3's and one 2 among the four digits. We can use the stars and bars method to count the number of ways to distribute these factors.

   - Distribute the two 3's among the four digits:
     \[
     \binom{4+2-1}{2} = \binom{5}{2} = 10
     \]
   - Distribute the one 2 among the four digits:
     \[
     \binom{4+1-1}{1} = \binom{4}{1} = 4
     \]

4. **Calculate the total number of distributions**:
   The total number of ways to distribute the factors is:
   \[
   10 \times 4 = 40
   \]

5. **Subtract illegal distributions**:
   We need to subtract the illegal distributions where one digit has all the factors (i.e., one digit is 18, which is not a single digit). This happens when one digit is 18 and the other three digits are 1. There are 4 such configurations (one for each digit being 18).

   Therefore, the number of illegal distributions is:
   \[
   4
   \]

6. **Calculate the valid distributions**:
   The number of valid distributions is:
   \[
   40 - 4 = 36
   \]

Conclusion:
The number of four-digit passcodes where the product of the digits is 18 is:

\[
\boxed{36}
\]