You may be able to use your credit card in certain restaurants, supermarkets and other establishments but for most shopping and other purchases in the old town, cash is the preferred form of payment (Moroccan Dirhams).
We recommend bringing with you a credit/debit card with no or low foreign transaction fees and some US currency which you can exchange while in Morocco. No need to exchange money at the airport or get Moroccan dirhams ahead of time, out team can advise on how to get the best exchange rate while in Marrakech.