craftcms / commerce-paypal-checkout

PayPal Checkout gateway for Craft Commerce.
https://plugins.craftcms.com/commerce-paypal-checkout
MIT License
5 stars 10 forks source link

Override paymentForm.js #80

Open gigo6000 opened 1 year ago

gigo6000 commented 1 year ago

What are you trying to do? I would like to add an extra parameter to the Buttons function, specifically an onInit/onClick (https://developer.paypal.com/sdk/js/reference/#link-oninitonclick) function. But I don't see any option in the plugin to do that.

What's your proposed solution? I think the simpler solution would be to be able to override the paymentForm.js file, I don't have much experience with Craftcms so not sure if that's possible by default. But I think another option would be to let the users add parameters as settings.

Additional context Add any other context or screenshots about the feature request here.

nfourtythree commented 1 year ago

Hi @gigo6000

Thank you for your message.

This is possible as it stands. The best way to achieve this is to simply remove the {{ cart.getPaymentFormHtml() }} tag from your payment template.

This will stop the plug-in from outputting the payment form HTML and JS and allow you to write your own.

From this point you can simply copy the paymentForm.js to your project and make the edits you require.

Hope this helps, thanks!

gigo6000 commented 1 year ago

Hi @nfourtythree thanks for the quick response!