Minecraft execute command minecart?

Tr
2

How can you find out with the execute command whether a player is sitting in a minecart (lore)?

PS. I play in the Java Edition.

Du

First I would spawn a minecart.

Minecart is created:

/ summon minecart ~ ~ ~ {Tags: ["Test"]}

Checking whether a player is sitting in the Minecart:

/ execute positioned as @e [tag = Test] if entity @p [distance = .0.5]

after that you can of course execute a command if this is positive

/ execute positioned as @e [tag = Test] if entity @p [distance = .0.5] run say Hello

Tr

Many Thanks