Hearts earlier just missed out on a place among the seeds on goals scored after beating Inverness 1-0.
Celtic beat Hearts in the 2019 and 2020 Scottish Cup finals and also knocked them out of the League Cup in 2018-19.
Rangers will host Peter Grant's Dunfermline while holders St Johnstone face a trip to Arbroath.
St Mirren secured a place among the seeds thanks to a 2-0 victory over Partick Thistle on Sunday but they were handed a difficult trip to Livingston, who beat them in last season's semi-finals.
Hearts' failure to score a second goal against Inverness allowed Dundee United to enter the draw as seeds and they will travel to Ayr on the weekend of August 14-15.
Hibernian will play Kilmarnock at Easter Road while former Aberdeen boss Derek McInnes drew the Dons out against Raith Rovers in Kirkcaldy. Dundee will host Motherwell.
Hearts had already won Group A before the visit of Caley Thistle but they needed to win and score at least twice to secure a seeded place.
Former Hearts goalkeeper Mark Ridgers pulled off an excellent stop from Finlay Pollock just before the break and both Armand Gnanduillet and Pollock hit the post in quick succession 10 minutes after the interval.
Substitute Jamie Walker lit up the contest with a powerful strike to open the scoring 15 minutes from time but the midfielder was denied by Ridgers three times before Michael Gardyne was sent off the visitors for a foul on the goalscorer.
Joe Shaughnessy netted five minutes into stoppage time to secure St Mirren a place among the seeded teams.
The Saints skipper's goal made it 2-0 and ensured they bettered Dundee United's record on away goals scored - partly thanks to being awarded a 3-0 win over Covid-hit Dumbarton.
Jamie McGrath's first-half penalty had put St Mirren on course to top the group but they passed up a series of second-half chances, through Curtis Main in particular, before Shaughnessy tapped home Lee Erwin's square ball from inside the six-yard box.