Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPaymentMethodIds example
}
$ruleId
=
$paymentMethod
->
getAvailabilityRuleId
(
)
;
if
(
$ruleId
&& !\
in_array
(
$ruleId
,
$context
->
getRuleIds
(
)
, true
)
)
{
$errors
->
add
(
new
PaymentMethodBlockedError
(
(string)
$paymentMethod
->
getTranslation
(
'name'
)
, 'rule not matching'
)
)
;
}
if
(
!\
in_array
(
$paymentMethod
->
getId
(
)
,
$context
->
getSalesChannel
(
)
->
getPaymentMethodIds
(
)
??
[
]
, true
)
)
{
$errors
->
add
(
new
PaymentMethodBlockedError
(
(string)
$paymentMethod
->
getTranslation
(
'name'
)
, 'not allowed'
)
)
;
}
}
}