Is it ok to set new canonical url in product variations group

Ecommerce shop has different pages for different product sizes:

  • /shirt-size-s/
  • /shirt-size-m/
  • /shirt-size-xl/

They all point to /shirt-size-s/ as canonical and only this page goes to sitemap.xml

What should happen when /shirt-size-s/ goes out of stock, but sizes M and L are still available? I guess I should:

  1. Remove /shirt-size-s/ from sitemap
  2. Add /shirt-size-m/ to sitemap
  3. Set canonical to /shirt-size-m/

Is this the best practice with current site structure?