I have an import script which imports configs and the variants.

There is set the special price if some is set in my import XML document. If no special price is set, i try to remove the special price. - But it do not work! - The special price is already set, after save!

if ($oProductGroupVariantProductItem->getSpecialpriceBrutto() > 0) {
} else {

what i am doing wrong?

Thanks Andre

  • try with unset($oProductGroupVariantProductItem->getSpecialpriceBrutto()) – Rakesh Jesadiya Jan 20 '17 at 13:06
  • ??? - I want to unset the "$oSimpleProduct" special price value !! Not my Import Data Value Object! – Andre Bubner Jan 20 '17 at 13:10
  • you can do this in else case of your condition – Rakesh Jesadiya Jan 20 '17 at 13:10
  • Any luck with this? – Martin Wickman Feb 21 '17 at 9:32

Saving the price and forcibly update the product attribute using the resource model worked in my situtation:

$product->getResource()->saveAttribute($product, 'special_price');

Note: Make sure a $product object has store_id = 0. special_price attribute is global attribute. If store_id won't be 0, this method won't work, then you will try to unset special_price.


You just need to save the product after you updated the attributes.

Try this:

  • Don't use deprecated save()-methods on legacy models. Use the repository instead (see ProductRepositoryInterface::save()). – Giel Berkers May 17 '17 at 12:13

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.