wpc_pre_init
The WooCommerce Putler Connector wpc pre init function.
Description
wpc_pre_init();
Usage
if ( !function_exists( 'wpc_pre_init' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce-putler-connector/woocommerce-putler-connector.php'; } // NOTICE! Understand what this does before running. $result = wpc_pre_init();
Defined (1)
The function is defined in the following location(s).
- /woocommerce-putler-connector.php
- function wpc_pre_init () {
- // Simple check for WooCommerce being active...
- if ( class_exists('WooCommerce') ) {
- // Init admin menu for settings etc if we are in admin
- if ( is_admin() ) {
- wpc_init();
- if ( false !== get_option( '_wpc_activation_redirect' ) && (current_user_can('import') === true) ) {
- // Delete the redirect transient
- delete_option( '_wpc_activation_redirect' );
- wp_redirect( admin_url('tools.php?page=putler_connector') );
- }
- }
- // If configuration not done, can't track anything...
- if ( null != get_option('putler_connector_settings', null) ) {
- // On these events, send order data to Putler
- if ( is_admin() ) {
- if( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) {
- add_action( 'post_updated', 'wpc_order_updated');
- }
- add_action ( 'woocommerce_order_refunded' , 'wpc_post_order', 10, 2 ); // added for handling manual refunds
- add_action ( 'woocommerce_process_shop_subscription_meta' , 'wpc_update_sub_meta', 10, 2 );// for handling subscription meta
- }
- add_action ( 'woocommerce_subscription_status_changed' , 'wpc_update_sub_status', 10, 3 ); // for handling subscription status change
- add_action ( 'woocommerce_checkout_subscription_created' , 'wpc_sub_created', 10, 2 );
- add_filter ( 'wcs_renewal_order_created' , 'wpc_renewal_order', 10, 2 ); // added for handling renewals
- add_action( 'woocommerce_order_status_changed', 'wpc_post_order', 10, 1 );
- }
- }
- }