1. Home
  2. Docs
  3. WooCommerce Order Builder
  4. Actions and Filters
  5. wwob_add_items_field

wwob_add_items_field

Use this action to add an additional field within items repeatable field inside WWOB metabox.

The following example will add a description field to product items:

add_action( 'wwob_add_items_field', 'wwob_add_items_field', 2, 10 );
function wwob_add_items_field($value, $field_type_object){

$value = wp_parse_args($value, array(
'product-description' => '',

));
?>

'name' => $field_type_object->_name( '[product-description]' ),
'id' => $field_type_object->_id( '_product_description' ),
'value' => $value['product-description'],
'placeholder' => 'extra description field',

) );
?>

 

The following example will display description value directly after item’s price:

add_action( 'wwob_after_product_item_price', 'do_something_after_item_price', 2, 10 );
function do_something_after_item_price($form_id, $choice){
$description = !empty($choice['product-description']) ? $choice['product-description'] : "";
echo $description;
}

 

Placement

This code should be placed in the functions.php file of your active theme.