As it stand I have managed to pull the Customer Group ID, Price Quantity and the Price itself. However there are other attributes:
- Price ID
- Website ID
- All Groups
- Percentage Value
- Website Price
None of these I am able to access currently. Here is my current code snippet:
$product = $this->_productRepository->get($productId);
$tierPrices = $product->getTierPrices();
$arrayToSend = [];
if(count($tierPrices) > 0){
foreach($tierPrices as $tier){
if($tier->getCustomerGroupId() == $custGroupId){
array_push($arrayToSend, $tier->getData());
}
if(count($arrayToSend) == 0){
array_push($arrayToSend, "Creating a new Special Price with given values because it doesnt exist already");
}
}
return $arrayToSend;
}
And this then returns:
[
{
"extension_attributes": {},
"customer_group_id": "1958",
"value": "4.5000",
"qty": "1.0000"
}
]
The goal is to return all of the attributes so that I can then edit them and create new ones. Below is all the attributes when pulling directly from the product without filtering by getTierPrice()
:
"tier_price": [
{
"price_id": "15924",
"website_id": "0",
"all_groups": "0",
"cust_group": "14",
"price": "3.0000",
"price_qty": "1.0000",
"percentage_value": null,
"website_price": "3.0000"
}
],
Any assistance with getting the remaining attributes would be appreciated.