Preheat the slow cooker if necessary; see the manufacturer's instructions. Heat the butter in a frying pan, add the lamb shanks and fry over a medium heat, turning until browned all over. Drain and put into the slow cooker pot.
Add the onions to the pan and fry for 4–5 minutes or until just beginning to turn golden. Stir in the flour. Gradually mix in the wine and stock, then add the cranberry sauce (if used) and the remaining ingredients. Bring to the boil, stirring.
Transfer to the slow cooker pot, cover with the lid and cook on high for 5–7 hours or until the lamb is beginning to fall off the bone. If you prefer a thick sauce, pour it into a saucepan and boil rapidly for 5 minutes or until reduced by one-third. Serve the lamb with mashed sweet potatoes and green beans.