Anyway to programmatically add default fields to a layout? So I've been building my plugin to import product listings directly from Salesforce. So far I've been making progress. However, I've approached another roadblock and I was wondering how I would approach this issue. I want to write some code to add default fields into my product layout (e.g.- Body richtext, Image Asset field), 

Someone showed me an example of this function that adds default content for a ProductType

/**
 * @throws \Craft\Exception
 * @throws \Exception
 */
private function defaultProductTypes()
{
    $productType = new Commerce_ProductTypeModel;
    $productType-&gt;name = 'Clothing';
    $productType-&gt;handle = 'clothing';
    $productType-&gt;hasDimensions = true;
    $productType-&gt;hasUrls = true;
    $productType-&gt;hasVariants = false;
    $productType-&gt;hasVariantTitleField = false;
    $productType-&gt;titleFormat = "{product.title}";
    $productType-&gt;template = 'shop/products/_product';

    $fieldLayout = FieldLayoutModel::populateModel(['type' =&gt; 'Commerce_Product']);
    \Craft\craft()-&gt;fields-&gt;saveLayout($fieldLayout);
    $productType-&gt;asa('productFieldLayout')-&gt;setFieldLayout($fieldLayout);

    $variantFieldLayout = FieldLayoutModel::populateModel(['type' =&gt; 'Commerce_Variant']);
    \Craft\craft()-&gt;fields-&gt;saveLayout($variantFieldLayout);
    $productType-&gt;asa('variantFieldLayout')-&gt;setFieldLayout($variantFieldLayout);

    \Craft\craft()-&gt;commerce_productTypes-&gt;saveProductType($productType);

    $productTypeLocales = \Craft\craft()-&gt;i18n-&gt;getSiteLocaleIds();

    foreach ($productTypeLocales as $locale) {
        \Craft\craft()-&gt;db-&gt;createCommand()-&gt;insert('commerce_producttypes_i18n', [
            'productTypeId' =&gt; $productType-&gt;id,
            'locale' =&gt; $locale,
            'urlFormat' =&gt; 'shop/products/{slug}'
        ]);
    }
}


I've tried to read through to see where I could include extra fields, but I'm a bit lost on where to start. Can anyone provide some insight or approach to this?
After hours of perusing, I managed to find a working solution to this issue.  I threw this implementation from InstallService located in craft/app/services.

I realized that CommerceProduct and Variant Field Layouts were set into the Commerce Product Type Model via setFieldLayout() function, therefore all I would need to do is create a new Field Layout with the fields that I required and set them into defaultProductTypes().

    //Write this code in between CommerceProductFieldLayout and Variant type field Layout

    //Any custom fields for your products go here.
    //Format: $yourFieldName = FieldsVariable::getFieldByHandle("Your field's 
handle");
    $bodyField = FieldsVariable::getFieldByHandle('body');
    $tagsField= FieldsVariable::getFieldByHandle('tags');

    //Assemble a new layout that contains the fields you need.
    $infoLayout = craft()-&gt;fields-&gt;assembleLayout(
        array(
            'Content' =&gt; array($bodyField-&gt;id, $tagsField-&gt;id) //Add fields into this array to display your plugins. (e.g. - $YourFieldVariable-&gt;id)
        ),
        array($bodyField-&gt;id) //Add any required fields here.
    );

    // Save Layout into specified product type.
    $productType-&gt;setFieldLayout($infoLayout);