I have added following fields to commerce product type of "product"

  1. Maturity (Taxonomy, set to Product Attributes): has value of Adults, Children
  2. Room (Taxonomy, set to Product Attributes): has value of Double, Single
  3. Price dates (type of Date with End date required)
  4. Price table (Commerce product price table, unlimited)

I've modified the public function defaultFields($bundles) in inline_entity_form/includes/commerce_product.inline_entity_form.inc to show dates and price table:

<?php
 
public function defaultFields($bundles) {
   
$fields = array();
   
$fields['title'] = array(
     
'type' => 'property',
     
'label' => t('Variation title'),
     
'visible' => TRUE,
     
'weight' => 1,
    );
   
$fields['sku'] = array(
     
'type' => 'property',
     
'label' => 'Price code',
     
'visible' => TRUE,
     
'weight' => 2,
    );
   
// If only one product type is allowed, its fields can be used as columns.
   
if (count($bundles) == 1) {
     
$bundle = reset($bundles);
       
$image_added = FALSE;
       
$hide_default_price = FALSE;    // hide default Commerce price
     
foreach (field_info_instances('commerce_product', $bundle) as $field_name => $instance) {
       
$field = field_info_field($field_name);
       
// If the product has an imagefield, show it.
       
switch ($field['type']){
            case
'image':
                if(!
$image_added){
                   
$fields[$field_name] = array(
                       
'type' => 'field',
                       
'label' => $instance['label'],
                       
'formatter' => 'image',
                       
'settings' => array('image_style' => 'thumbnail'),
                       
'delta' => 0,
                       
'visible' => TRUE,
                       
'weight' => -10,
                    );
                }
               
// Don't add any other imagefields. One is enough.
               
$image_added = TRUE;
                break;
            case
'datetime':
               
/*    Add field date    */
               
$fields[$field_name] = array(
                   
'type' => 'field',
                   
'label' => $instance['label'],    //t('Date'),
                   
'formatter' => 'date_default',
                   
'settings' => array('format_type' => 'short'),
                   
'visible' => TRUE,
                   
'weight' => 80,
                );
                break;
            case
'commerce_price_table':
               
/*    Add field field_price_table */
               
$fields[$field_name] = array(
                   
'type' => 'field',
                   
'label' => $instance['label'],
                   
'formatter' => 'commerce_multiprice_default',
                   
'settings' => array(),
                   
'visible' => TRUE,
                   
'weight' => 90,
                );
                if(
$instance['settings']['commerce_price_table']['hide_default_price'] == 1){
                   
$hide_default_price = TRUE;
                }
                break;
        }
      }
     
// If the type has up to 3 attributes, show them instead of the title field.
     
$attributes = $this->attributes($bundle);
      if (
count($attributes) <= 3) {
       
$fields['title']['visible'] = FALSE;
        foreach (
$attributes as $field_name => $attribute) {
         
$field_type = field_info_field_types($attribute['field']['type']);
         
// Override the default formatter for taxonomy_term_reference.
         
if ($field_type['default_formatter'] == 'taxonomy_term_reference_link') {
           
$field_type['default_formatter'] = 'taxonomy_term_reference_plain';
          }
         
$weight = -3;
         
$fields[$field_name] = array(
           
'type' => 'field',
           
'label' => $attribute['instance']['label'],
           
'formatter' => $field_type['default_formatter'],
           
'settings' => array(),
           
'visible' => TRUE,
           
'weight' => ++$weight,
          );
        }
      }
    }
    if(!
$hide_default_price){
       
$fields['commerce_price'] = array(
           
'type' => 'field',
           
'label' => t('Price'),
           
'formatter' => 'commerce_price_formatted_amount',
           
'settings' => array(),
           
'visible' => TRUE,
           
'weight' => 99,
        );
    }
   
$fields['status'] = array(
     
'type' => 'property',
     
'label' => t('Status'),
     
'visible' => TRUE,
     
'weight' => 100,
    );
    return
$fields;
  }
?>

The inline entity form displays as I expect, but when I add a new variation, the Save is pending forever.
I figure out that the issue is caused by price table because if I show dates only, the Saving task works well.

Comments

Category:feature» support
Priority:Major» Normal

Questions about custom code are support requests - not features. Also adjusting status - support requests should not be major.

Title:Inline entity form with commerce product has Price table and date fieldProduct with custom Price table hangs on saves

Updating title to be descriptive.

I'd suggest:

1) Narrowing down to *just* the price table addition, then nulling out the code, to troubleshoot.
2) Step level debugging, if necessary.

OP: please update this issue if still outstanding.

~1KT

Issue summary:View changes
Status:Active» Fixed

No further information provided.

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.