Automattic\WooCommerce\Enums
WeightUnit{}
Enum class for the possible values of the woocommerce_weight_unit option, which determines the weight unit used throughout the store.
No Hooks.
Usage
$WeightUnit = new WeightUnit(); // use class methods
Methods
- public static get_all()
Changelog
| Since 11.0.0 | Introduced. |
WeightUnit{} WeightUnit{} code WC 11.0.0
final class WeightUnit {
/**
* Kilogram.
*
* @var string
*/
public const KILOGRAM = 'kg';
/**
* Gram.
*
* @var string
*/
public const GRAM = 'g';
/**
* Pound.
*
* @var string
*/
public const POUND = 'lbs';
/**
* Ounce.
*
* @var string
*/
public const OUNCE = 'oz';
/**
* Returns all weight unit values defined in this class.
*
* @since 11.0.0
*
* @return string[]
*/
public static function get_all(): array {
return array(
self::KILOGRAM,
self::GRAM,
self::POUND,
self::OUNCE,
);
}
}