21
21
22
22
namespace Meta \Sales \Plugin ;
23
23
24
- use Magento \OfflineShipping \Model \Config \Backend \Tablerate ;
25
24
use Magento \Framework \Exception \FileSystemException ;
26
25
use Magento \Store \Model \StoreManagerInterface ;
27
26
use Meta \BusinessExtension \Model \System \Config as SystemConfig ;
28
27
use Magento \Framework \Filesystem ;
29
28
use Meta \BusinessExtension \Helper \GraphAPIAdapter ;
30
- use Magento \Framework \View \FileFactory ;
31
29
use Meta \BusinessExtension \Helper \FBEHelper ;
30
+ use Magento \Config \Model \Config ;
32
31
use Exception ;
33
32
34
33
class ShippingSettingsUpdatePlugin
@@ -79,7 +78,7 @@ public function __construct(
79
78
GraphAPIAdapter $ graphApiAdapter ,
80
79
FBEHelper $ fbeHelper ,
81
80
SystemConfig $ systemConfig ,
82
- StoreManagerInterface $ storeManager,
81
+ StoreManagerInterface $ storeManager
83
82
) {
84
83
$ this ->shippingRatesFactory = $ shippingRatesFactory ;
85
84
$ this ->fileSystem = $ fileSystem ;
@@ -92,10 +91,15 @@ public function __construct(
92
91
/**
93
92
* This function is called whenever shipping settings are saved in Magento
94
93
*
94
+ * @param Interceptor $config
95
95
* @throws FileSystemException
96
96
*/
97
- public function afterSave (): void
97
+ public function afterSave (Config $ config ): void
98
98
{
99
+ $ section_name = $ config ->getSection ();
100
+ if ($ section_name !== 'carriers ' ) {
101
+ return ;
102
+ }
99
103
foreach ($ this ->storeManager ->getStores () as $ store ) {
100
104
try {
101
105
$ shippingRates = $ this ->shippingRatesFactory ->create ();
0 commit comments