Some nouns + get mean achieve or obtain can be used like this:
- The trick to getting this chair to fold is [x]
- The solution to getting these voters to turn out is [x]
- The answer to getting more people at the park is [x]
get x to means: to obtain or achieve or persuade
- Getting people to understand you can be difficult.
- Getting better quality/price ratios is very hard.
I would say that the idiomatic usage is: Get x [direct object] to [verb] with or without a direct object.
To here is a preposition after a noun. Some nouns take to: the solution to, the way to, the answer to, the trick to, the solution to, etc.
Cambridge Dictionary, to after a noun
"To as a preposition: after nouns A number of nouns are followed by to. These include nouns expressing direction or destination such as door, entrance, road, route, way:"
One could consider that the word trick is a "direction or destination". In any event, the noun trick "takes" to.
So the grammar here is two things:
- the [x] to [to follows certain nouns, it is a preposition
- getting x to y, a noun phrase or clause that means: making it so that there is some outcome.
Get x to y is the idiom.