Skip to content

Commit 03df747

Browse files
nrostrow-metaNoah Ostrowski
andauthored
Setting up new config value to control whether or not dynamic checkout APIs should be enabled (#614)
Co-authored-by: Noah Ostrowski <[email protected]>
1 parent 305469b commit 03df747

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

app/code/Meta/BusinessExtension/Model/System/Config.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class Config
119119
private const XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_COMMERCE_EXTENSION_BASE_URL =
120120
'facebook/internal/extension_base_url';
121121

122+
private const XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_DYNAMIC_CHECKOUT_APIS =
123+
'facebook/business_extension/dynamic_checkout_apis_enabled';
124+
122125
/**
123126
* @var StoreManagerInterface
124127
*/
@@ -880,6 +883,22 @@ public function getAllOnsiteFBEInstalledStores()
880883
});
881884
}
882885

886+
/**
887+
* Check if dynamic checkout apis are enabled
888+
*
889+
* @param int|null $scopeId
890+
* @param string|null $scope
891+
* @return string|null
892+
*/
893+
public function areDynamicCheckoutApisEnabled(int $scopeId = null, string $scope = null): ?string
894+
{
895+
return $this->getConfig(
896+
self::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_DYNAMIC_CHECKOUT_APIS,
897+
$scopeId,
898+
$scope
899+
);
900+
}
901+
883902
/**
884903
* Get feed id
885904
*

app/code/Meta/BusinessExtension/etc/adminhtml/system.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
<config_path>facebook/business_extension/pixel_id</config_path>
4646
<frontend_model>Meta\BusinessExtension\Block\Adminhtml\System\Config\Field\Hidden</frontend_model>
4747
</field>
48+
<field id="dynamic_checkout_apis_enabled" type="select" sortOrder="40" showInDefault="1" showInWebsite="0"
49+
showInStore="1">
50+
<config_path>facebook/business_extension/dynamic_checkout_apis_enabled</config_path>
51+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
52+
<frontend_model>Meta\BusinessExtension\Block\Adminhtml\System\Config\Field\Hidden</frontend_model>
53+
</field>
4854
<field id="installed" type="select" sortOrder="50" showInDefault="1"
4955
showInWebsite="0" showInStore="1">
5056
<config_path>facebook/business_extension/installed</config_path>

app/code/Meta/BusinessExtension/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<business_extension>
77
<active>1</active>
88
<onsite>0</onsite>
9+
<dynamic_checkout_apis_enabled>0</dynamic_checkout_apis_enabled>
910
<client_access_token>195311308289826|52dcd04d6c7ed113121b5eb4be23b4a7</client_access_token>
1011
</business_extension>
1112
<catalog_management>

0 commit comments

Comments
 (0)