Auto-populate product minimum

Project: 
Product Minimum
Category: 
feature request
Priority: 
normal
Status: 
active

In uc_product_min.module, I added:

  if (preg_match('/.*add-to-cart-form.*/', $form_id)) {
    $form['qty']['#default_value'] = !empty($node->product_min) ? $node->product_min : 1;
  }

At line 71, so it now reads:

function uc_product_min_form_alter($form_id, &$form) {
  $node = $form['#node'];
  $product_types = uc_product_node_info();
  if (preg_match('/.*add-to-cart-form.*/', $form_id)) {
    $form['qty']['#default_value'] = !empty($node->product_min) ? $node->product_min : 1;
  }
  if ($form_id == $node->type .'_node_form' && isset($product_types[$node->type])){

This enables the default minimum to be set prior to check-out. Users can still choose less, and the logic to limit this upon checkout is still there.

Re: Auto-populate product minimum

Nice idea. I'll put this on my to-do list to return to and get it added in. Smiling