Spread the onion in a 6-quart slow cooker and set the pork pieces on top.
Pour the root beer around the pork, cover and cook on low until the meat shreds easily, 7 1/2 to 8 hours.
Transfer the pork to a board and discard large fat pockets.
Pour the cooking liquid and onion through a strainer, reserving 1/2 cup onion and discarding the liquid.
Shred the pork and return it to the cooker with the reserved onion and barbecue sauce.
Cover and cook on high until the sauce clings to the pork, 15 to 20 minutes.