Question

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?

Was it helpful?

Solution

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;
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top