diff --git a/Plugin/CheckoutAgreements/Model/AgreementsProviderPlugin.php b/Plugin/CheckoutAgreements/Model/AgreementsProviderPlugin.php
index 6d34ebf..08f7bfc 100644
--- a/Plugin/CheckoutAgreements/Model/AgreementsProviderPlugin.php
+++ b/Plugin/CheckoutAgreements/Model/AgreementsProviderPlugin.php
@@ -7,7 +7,6 @@
namespace Netzexpert\MinimumOrderFee\Plugin\CheckoutAgreements\Model;
-
class AgreementsProviderPlugin
{
@@ -25,7 +24,7 @@ class AgreementsProviderPlugin
public function __construct(
\Magento\Checkout\Model\Session $session,
\Magento\CheckoutAgreements\Api\CheckoutAgreementsRepositoryInterface $checkoutAgreementsRepository
- ){
+ ) {
$this->checkoutSession = $session;
$this->chekoutAgreementsRepository = $checkoutAgreementsRepository;
}
@@ -34,17 +33,18 @@ public function __construct(
/**
* @param \Magento\CheckoutAgreements\Model\AgreementsProvider $agreementsProvider
* @param int[] $agreementIds
+ * @return int[]
*/
public function afterGetRequiredAgreementIds(
\Magento\CheckoutAgreements\Model\AgreementsProvider $agreementsProvider,
$agreementIds
) {
$fee = $this->getMinimumOrderFeeValue();
- if(!$fee){
- foreach ($agreementIds as $key => $agreementId){
+ if (!$fee) {
+ foreach ($agreementIds as $key => $agreementId) {
$agreement = $this->chekoutAgreementsRepository->get($agreementId);
if ($agreement->getName() == 'Minimum Order Fee') {
- unset ($agreementIds[$key]);
+ unset($agreementIds[$key]);
}
}
}
@@ -54,13 +54,14 @@ public function afterGetRequiredAgreementIds(
/**
* @return bool
*/
- protected function getMinimumOrderFeeValue(){
+ protected function getMinimumOrderFeeValue()
+ {
$totals = $this->checkoutSession->getQuote()->getTotals();
- if(!isset($totals['minimumorderfee'])){
+ if (!isset($totals['minimumorderfee'])) {
return false;
}
/** @var \Magento\Quote\Model\Quote\Address\Total $minimumOrderFee */
$minimumOrderFee = $totals['minimumorderfee'];
return $minimumOrderFee->getValue();
}
-}
\ No newline at end of file
+}
diff --git a/Plugin/CheckoutAgreementsListPlugin.php b/Plugin/CheckoutAgreementsListPlugin.php
new file mode 100644
index 0000000..fc04bd3
--- /dev/null
+++ b/Plugin/CheckoutAgreementsListPlugin.php
@@ -0,0 +1,35 @@
+getMinimumOrderFeeValue();
+ if (!$fee) {
+ foreach ($agreements as $key => $agreement) {
+ if ($agreement->getName() == 'Minimum Order Fee') {
+ unset($agreements[$key]);
+ }
+ }
+ }
+ return $agreements;
+ }
+}
diff --git a/composer.json b/composer.json
index 6868916..a3702ac 100644
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,7 @@
"magento/module-sales": ">=100.0.0 <104"
},
"type": "magento2-module",
- "version": "1.0.1",
+ "version": "1.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml
index cceaa2f..6c03ed4 100644
--- a/etc/frontend/di.xml
+++ b/etc/frontend/di.xml
@@ -11,4 +11,8 @@
+
+
+
\ No newline at end of file