This is a great itinerary that follows the coast west of Marrakesh. It can be easily organised with a rented car. Alternatively, it works also with public transportation but it would take more time (add 1-2 days on top).
The trip was done in late September. Remember to take a jacket with you because Essaouira temperature can be unpredictable, with sunny and warm days but coolish nights well below 18-20 degrees Celsius
The website I use to rent my cars: https://mel365.com/MySuggestedCarRentalWebsite
The accommodations I suggest for this trip are:
El Jadida: https://www.booking.com/hotel/ma/a-casa-da-mare.en-gb.html?aid=910579&no_rooms=1&group_adults=2&label=MoroccoItin
Oualidia: https://www.booking.com/hotel/ma/dar-assalam-1.en-gb.html?aid=910579&no_rooms=1&group_adults=2&label=MoroccoItin
Essaouira: https://www.booking.com/hotel/ma/ryad-watier.en-gb.html?aid=910579&no_rooms=1&group_adults=2&label=MoroccoItin
Marrakesh: https://www.booking.com/hotel/ma/riad-challa.en-gb.html?aid=910579&no_rooms=1&group_adults=2&label=https://www.booking.com/hotel/ma/ryad-watier.en-gb.html?aid=910579&no_rooms=1&group_adults=2&label=MoroccoItin
++++++
My website: https://mel365.com/
Instagram: http://instagram.com/stef_travelphotography
Facebook: https://www.facebook.com/mel365
Twitter: https://twitter.com/Mel365dotCom