I have successfully read Group Price and Tier Price arrays from a product.
But I couldn't set Group Price and Tier Price attributes using the arrays for another product.
This is how a read Group Price and Tier Price array.
$groupPrices = $simpleProduct->getData('group_price');
if (is_null($groupPrices)) {
$attribute = $simpleProduct->getResource()->getAttribute('group_price');
if ($attribute) {
$attribute->getBackend()->afterLoad($simpleProduct);
$groupPrices = $simpleProduct->getData('group_price');
}
}
I have tried methods below to set them to another products
$product->setGroupPrice($groupPrices);
$product->setData('tier_price', $tierPrices);
$product->setData('tier_price', $tierPrices)->getResource()->saveAttribute($product, 'tier_price');
None of them worked. Help please!