You have to place a events.xml in the webapi_rest area: app/[Vendor]/[Module]/etc/webapi_rest/events.xml
By placing the events.xml in the webapi_restdirectory the observer only listens to events dispatched in that area.
You can read about the areas and events in the devdocs.
Observer doesn't provide sort order. So, it may be create issue when create same events in multiple events.
So, I would like to suggest you to create plugin for that and avoid same events use in multiple module. Plugin provide you to set sort order if same function's plugin create in multiple action. You can use plugin in method type will be public. ...
You could also go for the observer route, you can check all the events that are triggered here (for Magento 2.3). In this case I would try the event adminhtml_customer_save_after event (triggered here \Magento\Customer\Controller\Adminhtml\Index\Save::execute). The event contains data about the request and the customer, so it will be enough to work with.
You can use "customer_delete_after" event in Magento 2.3.
<observer name="ddg_remove_contact" instance="Dotdigitalgroup\Email\Observer\Customer\RemoveContact"/>
This event is used in Magento's dotmailer module in the vendor.
Below is the link for the event list in Magento 2.
You can listen to the sales_quote_save_after event, then use the quote to get the shipping rates. The following code can be used to get the list of shipping rates.
You need to create even observer as below
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<observer name="customer_login_observer" instance="<Your_packagename>\<...
I don't know wether your conditions work, I leave that up to you. The problem with the error comes - I assume - because the addProduct() is not inside a try/catch block.
The default Magento Controller looks like this:
public function addAction()
/* ... */
/* ... */
It's not update because you are using catalog_product_save_after event. So, on product save again event will be call. So, You can use controller_action_catalog_product_save_entity_after or catalog_product_save_before event and You can update SKU like this below code :
Yes, We could use multiple modules :
<observer name="adams_mage_add_custom_option" instance="CompanyName\ModuleName\Observer\AddCustomOption" />
for another module same event :
<observer name="inventory" instance="...
Yes you could use them in any number of Observers.
Events are dispatched in broadcasting manner, so any number of Observers can be listening to the same event. Either in same module or different module.
Yes you can use it multiple times in your project.
<observer name="my_custom_product_save_observer" instance="Vendor\module\Observer\Productsaveafter" />
And your observer code:
Change your app/etc/modules/Gta_KolupadiRestrict.xml
<?xml version="1.0" encoding="UTF-8"?>
You can try Something like this
$product = Mage::registry('current_product');
$prodID = $product->getId();
$_product = Mage::getModel('catalog/product')->load($prodID);
$categoryIds = $_product->getCategoryIds();
// Do something
Have you tried logging API rest calls and going from there.
But essentially it sounds like you are going to either have to introduce your own event in an override or modify something like the above to only catch shipstation calls.
For me, sales_order_save_commit_after was the only event that worked well:
If you need the event to be triggered in the admin area and also in the frontend, you can add the following code in etc/events.xml.
If you need it for the order created from admin only, you need to add the following code in etc/adminhtml/events.xml