I have created a custom payment method, however, I want to add a custom rule condition with the payment method rule and export it into code. I know I can add the rule condition via the UI, but I want to have the condition saved in code.

Is there a way of adding a rule condition to the payment method rule via code?

Thanks

Comments

rszrama’s picture

Status: Active » Fixed

Payment methods automatically have default rules created for them, so you need to determine if the default rule in your code can override that or not. If it can, then simply implement hook_default_rules_configuration() and define your rule; if not, then perhaps you can alter the default rule coming from the payment module. Look in commerce_payment.rules_defaults.inc for an example.

ivan zugec’s picture

Thanks for your help.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue.