modules/acm_sku/src/CartFormHelper.php
public function setConfigurableAttributeWeights($attribute_set = 'default', array $weights = []) {
    $attribute_set = strtolower($attribute_set);

    // Update weights for particular attribute set in config.
    $existing_weights = $this->config->get('attribute_weights');
    $existing_weights[$attribute_set] = $weights;

    $config = $this->configFactory->getEditable(self::CONFIG_KEY);
    $config->set('attribute_weights', $existing_weights);
    $config->save();

    // Reload config.
    $this->config = $this->configFactory->get(self::CONFIG_KEY);
  }
public function setConfigurableAttributeWeights($attribute_set = 'default', array $weights = []) {
    $attribute_set = strtolower($attribute_set);

    // Update weights for particular attribute set in config.
    $existing_weights = $this->config->get('attribute_weights');
    $existing_weights[$attribute_set] = $weights;

    $config = $this->configFactory->getEditable(self::CONFIG_KEY);
    $config->set('attribute_weights', $existing_weights);
    $config->save();

    // Reload config.
    $this->config = $this->configFactory->get(self::CONFIG_KEY);
  }
public function setConfigurableAttributeWeights ( $ attribute_set = 'default' , array $ weights = [ ] ) { $ attribute_set = strtolower ( $ attribute_set ) ; // Update weights for particular attribute set in config. $ existing_weights = $ this -> config -> get ( 'attribute_weights' ) ; $ existing_weights [ $ attribute_set ] = $ weights ; $ config = $ this -> configFactory -> getEditable ( self :: CONFIG_KEY ) ; $ config -> set ( 'attribute_weights' , $ existing_weights ) ; $ config -> save ( ) ; // Reload config. $ this -> config = $ this -> configFactory -> get ( self :: CONFIG_KEY ) ; }
Set the attribute codes with weight for particular attribute set.

@param string $attribute_set
Attribute set.
@param array $weights
Weights to set for the selected attribute set.
Set the attribute codes with weight for particular attribute set .