Note: this feature is available in WP Mapbox GL JS Advanced.
To add directions directly into a marker, use the checkbox marked “Directions button in popup”. This will add a button visibly onto the end of the content in your popup. Make sure you don’t change the HTML; it’s set up to make your button work.
Here is what it will look like in the backend:
And the frontend. The button will style with normal defaults of your theme, or you can hook into the
.mapboxgl-popup-content button
CSS declarer to change its style.
Please note: this may insert coordinates into the destination input box. We recommend putting the address into the popup box.