6

I mean the final price that Magento calculated and inserted in catalog_product_index_price table.

It may have applied special price/catalog price rule/tier price, which price is displayed to customer as final price.

Anyone have ideas which API I can use?

2
  • Did you get any solution? Commented Aug 2, 2019 at 8:43
  • No. I have to call all price API e.g. special price/ tier price, and pick the lowest price by myself.
    – leo
    Commented Aug 26, 2019 at 7:20

1 Answer 1

0

Please check using create custom script and add below code :

// get token
$userData = array("username" => "addyourusername", "password" => "yourpassword");
$ch = curl_init("https://demo.com/index.php/rest/V1/integration/admin/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

$token = curl_exec($ch);
$token = str_replace('"', '', $token);

// get product special price
$ch = curl_init("https://demo.com/index.php/rest/V1/products/SKU-NAME");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token));

$result = curl_exec($ch);
$data = json_decode($result,true);
$specialPrice = $data['price'];

foreach ($data['custom_attributes'] as $attr) {
    if ($attr['attribute_code'] == 'special_price') {
        $specialPrice = $attr['value'];
    }
}
echo $specialPrice;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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