"catalog_product_save_before" This event gets called for every product save action, including new products.
In order to use it you could do the following in your module:
**app\code\Vendor\Module\etc\webapi_rest\events.xml**
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_product_save_before">
<observer name="catalog_product_save_before_check_condition" instance="Vendor\Module\Observer\Productsaveafter" />
</event>
</config>
Then in `Productsaveafter.php` you can implement logic to connect to your own software and perform actions like adding or updating the product.
Example:
**app\code\Vendor\Module\Observer\Productsaveafter.php**
<?php
namespace Vendor\Module\Observer;
class Productsaveafter implements ObserverInterface{
public function execute(\Magento\Framework\Event\Observer $observer) {
$product = $observer->getProduct();
// Your logic to do stuff with $product
}
}
Happy Coading ... Cheers !!!!!
0 comments:
Post a Comment