0

I would like to add a new product attribute to the file

Magento_Catalog/templates/product/price/amount/default.phtml

And

Magento_Tax/templates/pricing/adjustment.phtml

As an additional data tag like:

data-new-attribute="(value of the new product attribute)"

How do I get access to the data here?

0

You can get attribute using block

$_product = $block->getProduct(); 
$sku = $_product->getSku();

or using object manager

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
$product_name = $product->getName();
$product_id =   $product->getSku();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.