get_parent_id(), $type, $role, 'edit' ); } } self::$cache[ $cacheKey ][ $type ] = $value; } $value = Form::isEmpty( $value ) ? null : $value; if ( 'edit' !== $context ) { return apply_filters( 'tiered_pricing_table/advanced_quantity/get_' . $type, $value, $productId, $role ); } return $value; } public static function updateMaximumQuantity( $productId, $value, $role = false ) { self::update( $productId, 'maximum', $value, $role ); } public static function updateGroupOfQuantity( $productId, $value, $role = false ) { self::update( $productId, 'group_of', $value, $role ); } public static function getMaximumQuantity( $productId, $role = false, $context = 'view' ) { return self::get( $productId, 'maximum', $role, $context ); } public static function getGroupOfQuantity( $productId, $role = false, $context = 'view' ) { return self::get( $productId, 'group_of', $role, $context ); } public static function updateFromRequest( $fieldToUpdate, $entityId, $role = null, $loop = null, $customPrefix = null ) { $base = array( 'maximum' => AdvancedQuantityOptionsAddon::MAXIMUM_QUANTITY_BASE_META_KEY, 'group_of' => AdvancedQuantityOptionsAddon::GROUP_OF_QUANTITY_BASE_META_KEY, ); if ( ! isset( $base[ $fieldToUpdate ] ) ) { return; } $value = Form::getFieldValue( $base[ $fieldToUpdate ], $role, $loop, $customPrefix ); self::update( $entityId, $fieldToUpdate, $value, $role ); } }