businessdad

WooCommerce Subscriptions - Filter for PayPal settings

May 7th, 2015
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. // Need a consultation? Find Aelia on Codeable: https://bit.ly/codeable_discount
  2.  
  3. /*** This code has to be used within context, when an order (subscription) is being processed ***/
  4. // $order is instance of WC_Order
  5. $currency = $order->get_order_currency();
  6. // Allow the PayPal settings to be changed on the fly. The filter could replace the default value of
  7. // "api_username", "api_password" and so on with the currency specific settings
  8. $paypal_settings = apply_filters('wc_subscriptions_get_paypal_settings', self::get_wc_paypal_settings(), $currency);
  9.  
  10. // After the filter, you can still refer to the original setting names. If no substitution was performed,
  11. // you will get the default ones, as you already do
  12. $api_username = $paypal_settings['api_username'];
  13. $api_password= $paypal_settings['api_password'];
  14. $api_signature= $paypal_settings['api_signature'];
Add Comment
Please, Sign In to add comment