vyskoczilova / woocommerce-payforpayment-old

Setup individual charges for each payment method in woocommerce.
19 stars 15 forks source link

Call add_payment_options on woocommerce_init action #6

Closed ericnicolaas closed 10 years ago

ericnicolaas commented 10 years ago

A customer using our bundle rate shipping plugin for Woocommerce (http://codecanyon.net/item/woocommerce-ecommerce-bundle-rate-shipping/1429243) encountered a fatal error when they had woocommerce-payforpayment installed. I just took a look through the code and was eventually able to narrow down the cause.

Essentially, this happens because you have called the add_payment_options on the before_woocommerce_init action. Our plugin loads the shipping class on woocommerce_init. While cycling through the payment gateways, your plugin eventually calls the COD payment gateway, which tries to instantiate all the registered shipping methods.

I'm looking to see if I can improve this in our plugin, but thought it might be worth changing the point at which you call this function, as I'm guessing you may end up with some other plugin incompatibilities as well.

Cheers, Eric

mcguffin commented 10 years ago

Hi, I just set the hook to woocommerce_init. Works still well, so I included it in the 'official' version. (Testing and verifying took me while – sorry.) Cheers and Thanks for your suggestions jörn