How the cart price rule is applied in custom module?
Pergunta
I followed mageworx blog to add Conditions fieldset in my custom module and I added it successfully.
https://blog.mageworx.com/2016/09/magento-2-module-with-conditions-model-fieldset/
Now, how can I apply it to order complete observer?
Would anyone please help me?
Solução
I finally got an answer to apply validation to my custom rule. Below is working code if it helps to anyone.
$rule->afterLoad();
if ($quote->isVirtual()) {
$address = $quote->getBillingAddress();
} else {
$address = $quote->getShippingAddress();
}
if($rule->validate($address)){
return $rule;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange