Hi I am very new to magento and i want to add a variable that is the size variable that i know exist when you look in the minicart but for some reason I cant seem to find the variable anywhere in the magento wishlist file that is cart.phtml I tried var_dump the $item but it just make the page dont even load. I also tried just use getProduct->getattribute(‘size’) but it I dont know why still didnt work. I am very new in magento so I hope someone could help me with this.
This is the cart.phtml file for magento wishlist.
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var MagentoWishlistBlockCustomerWishlistItemColumnCart $block */
/** @var MagentoWishlistModelItem $item */
$item = $block->getItem();
$product = $item->getProduct();
/** @var MagentoWishlistViewModelAllowedQuantity $viewModel */
$viewModel = $block->getData('allowedQuantityViewModel');
$allowedQty = $viewModel->setItem($item)->getMinMaxQty();
var_dump($item->gettype());
?>
<?php foreach ($block->getChildNames() as $childName) : ?>
<?= /* @noEscape */ $block->getLayout()->renderElement($childName, false) ?>
<?php endforeach;?>
<div class="box-tocart">
<fieldset class="fieldset">
<?php if ($item->canHaveQty() && $product->isVisibleInSiteVisibility()) : ?>
<div class="field qty">
<label class="label" for="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
<div class="control">
<input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty" data-validate="{'required-number':true,'validate-greater-than-zero':true, 'validate-item-quantity':{'minAllowed':<?= /* @noEscape */ $allowedQty['minAllowed'] ?>,'maxAllowed':<?= /* @noEscape */ $allowedQty['maxAllowed'] ?>}}"
name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */ $block->getAddToCartQty($item) * 1 ?>" <?= $product->isSaleable() ? '' : 'disabled="disabled"' ?>>
</div>
</div>
<?php endif; ?>
<?php if ($product->isSaleable()) : ?>
<div class="product-item-actions">
<div class="actions-primary">
<button type="button" data-role="tocart" data-post='<?= /* @noEscape */ $block->getItemAddToCartParams($item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" data-item-id="<?= $block->escapeHtmlAttr($item->getId()) ?>" class="action tocart action btn btn-primary primary">
<span class="fa fa-shopping-cart"></span>
<span class="text"><?= $block->escapeHtml(__('Add to Cart')) ?></span>
</button>
</div>
</div>
<?php else : ?>
<?php if ($product->getIsSalable()) : ?>
<p class="available stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<span><?= $block->escapeHtml(__('In stock')) ?></span>
</p>
<?php else : ?>
<p class="unavailable stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<span><?= $block->escapeHtml(__('Out of stock')) ?></span>
</p>
<?php endif; ?>
<?php endif; ?>
</fieldset>
</div>