code: private function removeInvariantAttributes(IItem $nativeItem, ICollection $renderSetting)
      {
          $model = $nativeItem->getMetaModel();
  
          if ($model->hasVariants() && !$nativeItem->isVariantBase()) {
              // Create a clone to have a separate copy of the object as we are going to manipulate it here.
              $renderSetting = clone $renderSetting;
  
              // Loop over all attributes and remove those from rendering that are not desired.
              foreach (array_keys($model->getInVariantAttributes()) as $strAttrName) {
                  $renderSetting->setSetting($strAttrName, null);
              }
          }
  
          return $renderSetting;
      }
docs: Remove invariant attributes from the render setting.
  
  This is done by cloning the input collection of render settings and removing any invariant attribute.
  
  @param IItem       $nativeItem    The native item.
  
  @param ICollection $renderSetting The render setting to be used.
  
  @return ICollection