Place the onions and garlic in an even layer in the slow cooker and pour in the stock or broth. Combine the sugar, chili powder, measured salt, cumin, and cinnamon in a small bowl. Pat the pork dry with paper towels. Rub the spice mixture all over the pork and place the meat on top of the onions and garlic. Cover and cook until the pork is fork tender, about 6 to 8 hours on high or 8 to 10 hours on low.
Turn off the slow cooker and remove the pork to a cutting board. Set a fine-mesh strainer over a medium heatproof bowl. Pour the onion mixture from the slow cooker through the strainer and return the solids to the slow cooker. Set the strained liquid aside.
If the pork has a bone, remove and discard it. Using 2 forks, shred the meat into bite-sized pieces, discarding any large pieces of fat. Return the shredded meat to the slow cooker, add the barbecue sauce, if using, and mix to combine. If you’re not using barbecue sauce, use a spoon to skim and discard the fat from the surface of the strained cooking liquid, and then add 1/4 cup of the liquid at a time to the slow cooker until the pork is just moistened. Taste and season with salt as needed.