0

I am trying to get access to the special product prices using PHP. These have already been set to the products themselves under the Advanced Pricing section. My end goal is to access these products' special prices and then also set some specific customer group prices of my own.

From what I am aware there are two points to access this: The Product Repository and Magento 2's REST Endpoints. I would prefer to access it through the product repository. Any help appreciated.

1 Answer 1

2

Been searching for a long time in how to sort this. Turns out by doing something like:

$product = $this->_productRepository->get($productId);
$tierPrices = $product->getTierPrices();
if(count($tierPrices) > 0){
        foreach($tierPrices as $tier){
            array_push($arrayToSend, $tier->getData());
        }
}

Works really well for acquiring all the tier prices for every product. From here specific customer group prices can be set as it already has all the tier prices configured for every product.

Your Answer

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

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