3

I need an observer when a new product is added, I don't need one when a product already exists and it is updated. I found catalog_product_save_after and _before but this is triggered when a product is saved. Is there a way to get Magento knows when a product is new?

1

Have never done this, but you can try using catalog_product_save_before then checking $product->isObjectNew() to check if the product is newly added product

  • Thanks it works, alternative way is checking if product->getId() is empty. – blob Apr 1 at 12:06
  • isObjectNew() calls product->getId() internally, but it add some extra checks. – R. Jansen Apr 1 at 13:28

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.