Jump to content
pageup

Hook adding discount on payment method selection

Recommended Posts

Hi,

I am trying to create a module (or even a simple controller or an override :D (worst case senarion)), to add a discount depending on which payment method a user selected.

Is there any hook for it?

Thank you!

Share this post


Link to post
Share on other sites
On 10/25/2019 at 2:00 PM, pageup said:

Hi,

I am trying to create a module (or even a simple controller or an override :D (worst case senarion)), to add a discount depending on which payment method a user selected.

Is there any hook for it?

Thank you!

Hi,

you can use displayPaymentReturn hook or override OrderConfirmationController to check order info and payment method selected then add discount on that based of payment method by adding rule to context cart 

use cart rule or create rule dynamically 

$cart_rule_id = your rule id;

$cart_rule = new CartRule($cart_rule_id);
$values = array(
    'tax_incl' => $cart_rule->getContextualValue(true),
    'tax_excl' => $cart_rule->getContextualValue(false)
);
$this->context->cart->addCartRule($cart_rule->id, $cart_rule->name[Configuration::get('PS_LANG_DEFAULT')], $values);

Hope this help you 
let me know if any issue 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More