Retrieve Magento 2 Value

Job ID: 31371140

Budget: $10 – $30 USD

This is a simpe 5 minute project for a megento developer.

I have a block on the product view page that needs to display text based on a value retrieved for the viewed product.

I am not going to give access, ftp access, admin access or any such thing. The project is to assist me. You can assist by submitting the correct code to me or live with anydesk or similar.

If Default Salable Qty is greater than 0 then "In stock" must be displayed, else the "Lead Time" which is an attribute"

Example:
<?php $_product = $block->getProduct() ?>
<?php $_productStock = $block->getStockItem() ?>

<?php if ($block->displayProductStockStatus()): ?>
<?php if ($_product->isAvailable()): ?>
<?php if (Y > 0): >?>
<div class="stock available" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
<span class="label"><?php /* @escapeNotVerified */ echo __('Availability:') ?></span>
<span><?php /* @escapeNotVerified */ echo __('In stock') ?></span>
</div>
<?php else: ?>
<div class="stock unavailable" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
<span class="label"><?php /* @escapeNotVerified */ echo __('Availability:') ?></span>
<span><?php echo $_product->getResource()->getAttribute('lead_time')->getFrontend()->getValue($_product) ?></span>
</div>
<?php endif; ?>
<?php else: ?>
<div class="stock unavailable" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
<span class="label"><?php /* @escapeNotVerified */ echo __('Availability:') ?></span>
<span><?php /* @escapeNotVerified */ echo __('Out of stock') ?></span>
</div>
<?php endif; ?>
<?php endif; ?>


I need to retrieve "Y" in the above and cannot get the value.

location of block:
app/design/frontend/Smartwave/porto_child/Magento_Catalog/templates/product/view/type/default.phtml
Related categories: PHP Magento Magento 2