You need to update code like below for multiselect attribute.
For xml file please add like below.
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.upc_code2" template="Magento_Catalog::product/view/attribute.phtml" after="product.info.upc_code">
<arguments>
<argument name="at_call" xsi:type="string">getUpcMulti</argument>
<argument name="at_code" xsi:type="string">upc_multi</argument>
<argument name="css_class" xsi:type="string">upc_multi</argument>
<argument name="at_label" xsi:type="string">default</argument>
<argument name="at_type" xsi:type="string">multiselect</argument>
<argument name="add_attribute" xsi:type="string">itemprop="upc_multi"</argument>
</arguments>
</block>
You need to override attribute.phtml file in your theme path. Path
will be like app/design/frontend/{{YOUR THEME NAME HERE}}/{{YOUR THEME
PACKAGE NAME
HERE}}/Magento_Catalog/templates/product/view/attribute.phtml
Multi select attributes values are saved comma separated in database. So we need to get it's option labels programmatically like below.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
/**
* Product view template
*
* @var $block \Magento\Catalog\Block\Product\View\Description
*/
?>
<?php
$_helper = $this->helper(Magento\Catalog\Helper\Output::class);
$_product = $block->getProduct();
if (!$_product instanceof \Magento\Catalog\Model\Product) {
return;
}
$_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)
: '';
} if ($_attributeType && $_attributeType == 'multiselect') {
$_attributeValue = '';
$explodeAttributes = $_helper->productAttribute($_product, $_product->$_call(), $_code);
$explodeAttributes = explode(',', $explodeAttributes);
$isAttributeExist = $_product->getResource()->getAttribute($_code);
if ($isAttributeExist && $isAttributeExist->usesSource()) {
foreach ($explodeAttributes as $key => $optionId) {
$_attributeValue .= $isAttributeExist->getSource()->getOptionText($optionId). ',';
}
}
$_attributeValue = trim($_attributeValue, ',');
} else {
$_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);
}
?>
<?php if ($_attributeValue) :?>
<div class="product attribute <?= $block->escapeHtmlAttr($_className) ?>">
<?php if ($renderLabel) :?>
<strong class="type"><?= $block->escapeHtml($_attributeLabel) ?></strong>
<?php endif; ?>
<div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>><?= /* @noEscape */ $_attributeValue ?></div>
</div>
<?php endif; ?>
Please do changes in code as per you want to show multi select option labels.
Cheers!