vendor/magento/module-catalog/view/frontend/templates/product/view/attribute.phtml
You can override this file in your custom theme and add the custom attribute text before details tab content.
app/design/frontend/VendorName/ThemeName/Magento_Catalog/templates/product/view/attribute.phtml
I have added custom_attribute attribute in my local project and working fine. You can get custom attribute value like this : $_product->getCustomAttribute();
<?php
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
$_call = $block->getAtCall();
$_code = $block->getAtCode();
$_className = $block->getCssClass();
$_attributeLabel = $block->getAtLabel();
$_attributeType = $block->getAtType();
$_attributeAddAttribute = $block->getAddAttribute();
$renderLabel = true;
// if defined as 'none' in layout, do not render
if ($_attributeLabel == 'none') {
$renderLabel = false;
}
if ($_attributeLabel && $_attributeLabel == 'default') {
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel();
}
if ($_attributeType && $_attributeType == 'text') {
$_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : '';
} else {
$_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);
}
?>
<?php if ($_attributeValue): ?>
<?php /** This will display custom attribute value **/ ?>
<?php if ($_code == 'description') : ?>
<?php echo $_helper->productAttribute($_product, $_product->getCustomAttribute(), 'custom_attribute'); ?>
<?php endif; ?>
<?php if ($renderLabel): ?><strong class="type"><?= /* @escapeNotVerified */ $_attributeLabel ?></strong><?php endif; ?>
<div class="value" <?= /* @escapeNotVerified */ $_attributeAddAttribute ?>><?= /* @escapeNotVerified */ $_attributeValue ?></div>
</div>
<?php endif; ?>
Please clear cache after changing the file.
hope this is helpful.