Skip to content

Price ​

The price input type renders VInputPrice, a currency-aware numeric input for entering prices. It supports multiple currency rows, an optional VAT rate selector, an optional discount percentage field, and displays a formatted total when VAT or discount is active.

IMPORTANT

This component requires the SystemPricing module. Currencies are loaded via the CurrencyProviderInterface contract.

Hydrate ​

Class: PriceHydrateConfig type: priceOutput type: input-price → VInputPrice

The hydrate:

  • Defaults name to prices and label to "Prices"
  • Sets priceInputName from Price::$priceSavingKey (typically price_value)
  • Builds the default array from Price::defaultAttributes() with the first available currency
  • Loads items (currencies) via CurrencyProviderInterface::getCurrenciesForSelect()
  • When hasVatRate: true, loads vatRates from VatRateRepository
  • Sets clearable: false

Usage ​

Basic price field ​

php
[
    'type'  => 'price',
    'name'  => 'prices',
    'label' => 'Price',
]

With VAT rate selector ​

php
[
    'type'       => 'price',
    'name'       => 'prices',
    'hasVatRate' => true,
]

With discount ​

php
[
    'type'        => 'price',
    'name'        => 'prices',
    'hasDiscount' => true,
    'hasVatRate'  => true,
]

Schema Defaults ​

KeyDefaultDescription
name'prices'Form field name
col{cols:6, sm:5, md:4}Default column width
priceInputNamePrice::$priceSavingKeyKey within each price row
clearablefalseCannot be cleared
showVatRatetrueShow the VAT rate selector (when vatRates are present)
hasDiscountfalseShow a discount percentage field
numberMultiplier100Internal multiplier for integer storage

See Also ​