Commit 03c7dab0 authored by nicola85's avatar nicola85

Make “Price” field required

parent 29792683
......@@ -852,12 +852,19 @@ function bee_add_price_field($field_name, $node_type) {
}
if (empty($field)) {
$store_storage = \Drupal::entityTypeManager()->getStorage('commerce_store');
$default_store = $store_storage->loadDefault();
$field = FieldConfig::create([
'field_storage' => $field_storage,
'entity_type' => 'node',
'label' => 'Price',
'bundle' => $node_type->id(),
'required' => FALSE,
'required' => TRUE,
'default_value' => [
'number' => 0,
'currency_code' => $default_store->getDefaultCurrencyCode(),
],
'settings' => [],
]);
$field->save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment