Skip to content

Commit 6f006fe

Browse files
danielmetaconnollyathensbirdDaniel M Connollysinghramanpreett
authored
Changing the way that shipping settings sync is triggered (#406)
* Update dependency versions for version 1.2.0 * changes * change * changes * changes * changes * linter * changes * changes * Revert "changes" This reverts commit 38c81d53c0564bfd55b957aeb0799aab510734fd. * Category sync cron job enabled (#405) * Mapping added for age group (#408) * 0 SKU id issue fixed for product feed (#411) * 0 SKU id issue fixed * 0 SKU id issue fixed * removing trailing comma * removing unneccessary imports * changes * changes to appease linter --------- Co-authored-by: Mark Wang <[email protected]> Co-authored-by: Daniel M Connolly <[email protected]> Co-authored-by: singhramanpreett <[email protected]>
1 parent ee4744b commit 6f006fe

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

app/code/Meta/Sales/Plugin/ShippingSettingsUpdatePlugin.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121

2222
namespace Meta\Sales\Plugin;
2323

24-
use Magento\OfflineShipping\Model\Config\Backend\Tablerate;
2524
use Magento\Framework\Exception\FileSystemException;
2625
use Magento\Store\Model\StoreManagerInterface;
2726
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
2827
use Magento\Framework\Filesystem;
2928
use Meta\BusinessExtension\Helper\GraphAPIAdapter;
30-
use Magento\Framework\View\FileFactory;
3129
use Meta\BusinessExtension\Helper\FBEHelper;
30+
use Magento\Config\Model\Config;
3231
use Exception;
3332

3433
class ShippingSettingsUpdatePlugin
@@ -79,7 +78,7 @@ public function __construct(
7978
GraphAPIAdapter $graphApiAdapter,
8079
FBEHelper $fbeHelper,
8180
SystemConfig $systemConfig,
82-
StoreManagerInterface $storeManager,
81+
StoreManagerInterface $storeManager
8382
) {
8483
$this->shippingRatesFactory = $shippingRatesFactory;
8584
$this->fileSystem = $fileSystem;
@@ -92,10 +91,15 @@ public function __construct(
9291
/**
9392
* This function is called whenever shipping settings are saved in Magento
9493
*
94+
* @param Interceptor $config
9595
* @throws FileSystemException
9696
*/
97-
public function afterSave(): void
97+
public function afterSave(Config $config): void
9898
{
99+
$section_name = $config->getSection();
100+
if ($section_name !== 'carriers') {
101+
return;
102+
}
99103
foreach ($this->storeManager->getStores() as $store) {
100104
try {
101105
$shippingRates = $this->shippingRatesFactory->create();

app/code/Meta/Sales/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<type name="Magento\Sales\Api\OrderRepositoryInterface">
66
<plugin name="facebook_order_extension" type="Meta\Sales\Plugin\OrderGet"/>
77
</type>
8-
<type name="Magento\OfflineShipping\Model\Config\Backend\Tablerate">
8+
<type name="Magento\Config\Model\Config">
99
<plugin name="facebook_shipping_profiles" type="Meta\Sales\Plugin\ShippingSettingsUpdatePlugin"
1010
/>
1111
</type>

0 commit comments

Comments
 (0)