0

I am working in Magento 2. I need to get getTireprice ,getSpecialprice and getfinalprice?

Anyone please provide same code for this.

2
  • I know how to get in Magento 1.9. How to get in Magento 2 – Rama Chandran M Jun 12 '17 at 13:20
  • hi @rama chandran here i have posted an answer for your question with simple test code so that you can able understand easily. – Nagaraju K Jun 12 '17 at 13:45
1

Step 1: Create a customtest.php and copy the below code and paste in the customtest.php and run it.

Step 2: customtest.php

<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');


//product Information 
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Catalog\Model\Product')->load(1);
echo "Product Name ==".$product->getName()."<br>";
echo "product price ===".$product->getPrice()."<br>";
echo  "product final price ===".$product->getFinalPrice()."<br>";//
echo "product special price ===".$product->getSpecialPrice()."<br>";


getAnyGroupData($product); //custom function

function getAnyGroupData($product)
{
  $tierPrice=$product->getTierPrices();

  if(count($tierPrice) > 0)
  {
    foreach ($tierPrice as $price)
    {
        echo "Tier Price Value ==".$price->getValue()."<br>";


    }

  }

}

?>

screenshots:

it shows an output it showing admin side how we have specified

1

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.