/**
  * Prepare data for configurable product.
  *
  * @param ConfigurableProduct $product
  * @return array
  */
 protected function prepareConfigurableData(ConfigurableProduct $product)
 {
     $result = [];
     $checkoutData = $product->getCheckoutData();
     $result['qty'] = $checkoutData['qty'];
     $attributesData = $product->hasData('configurable_options') ? $product->getDataFieldConfig('configurable_options')['source']->getAttributesData() : null;
     if ($attributesData == null) {
         return $result;
     }
     foreach ($checkoutData['options']['configurable_options'] as $key => $option) {
         $attributeId = $attributesData[$key]->getAttributeId();
         $optionId = $attributesData[$key]->getOptions()[substr($option['value'], -1)]['id'];
         $result['super_attribute'][$attributeId] = $optionId;
     }
     return $result;
 }