wpc_pre_init

The WooCommerce Putler Connector wpc pre init function.

Description

wpc_pre_init(); 

Usage

  1. if ( !function_exists( 'wpc_pre_init' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-putler-connector/woocommerce-putler-connector.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpc_pre_init(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/woocommerce-putler-connector.php  
  1. function wpc_pre_init () { 
  2.  
  3. // Simple check for WooCommerce being active... 
  4. if ( class_exists('WooCommerce') ) { 
  5.  
  6. // Init admin menu for settings etc if we are in admin 
  7. if ( is_admin() ) { 
  8. wpc_init(); 
  9.  
  10. if ( false !== get_option( '_wpc_activation_redirect' ) && (current_user_can('import') === true) ) { 
  11. // Delete the redirect transient 
  12. delete_option( '_wpc_activation_redirect' ); 
  13. wp_redirect( admin_url('tools.php?page=putler_connector') ); 
  14.  
  15. }  
  16.  
  17. // If configuration not done, can't track anything... 
  18. if ( null != get_option('putler_connector_settings', null) ) { 
  19. // On these events, send order data to Putler 
  20. if ( is_admin() ) {  
  21. if( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) { 
  22. add_action( 'post_updated', 'wpc_order_updated'); 
  23.  
  24. add_action ( 'woocommerce_order_refunded' , 'wpc_post_order', 10, 2 ); // added for handling manual refunds 
  25. add_action ( 'woocommerce_process_shop_subscription_meta' , 'wpc_update_sub_meta', 10, 2 );// for handling subscription meta 
  26.  
  27. add_action ( 'woocommerce_subscription_status_changed' , 'wpc_update_sub_status', 10, 3 ); // for handling subscription status change 
  28. add_action ( 'woocommerce_checkout_subscription_created' , 'wpc_sub_created', 10, 2 ); 
  29. add_filter ( 'wcs_renewal_order_created' , 'wpc_renewal_order', 10, 2 ); // added for handling renewals 
  30.  
  31.