I have a product with a custom field, according to this. I know I can create product with
$cp = commerce_product_new('product'); $cp->is_new = TRUE; $cp->revision_id = NULL; $cp->uid = 1; $cp->status = 1; $cp->created = $cp->changed = time(); $cp->sku = $product[sku]; $cp->title = $product[name]; $cp->language = LANGUAGE_NONE; $cp->commerce_price = array(LANGUAGE_NONE => array( 0 => array( 'amount' => $product[sale_price] ? $product[sale_price] : $product[retail_price], 'currency_code' => 'USD', )));$product[retail_price]; commerce_product_save($cp);
but I have some custom field.
How can I create a Drupal Commerce product programmatically with full custom fields?