WC_Correios_Install

WC_Correios_REST_API class.

Defined (1)

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

/includes/class-wc-correios-install.php  
  1. class WC_Correios_Install { 
  2.  
  3. /** 
  4. * Get version. 
  5. * @return string 
  6. */ 
  7. private static function get_version() { 
  8. return get_option( 'woocommerce_correios_version' ); 
  9.  
  10. /** 
  11. * Update version. 
  12. */ 
  13. private static function update_version() { 
  14. update_option( 'woocommerce_correios_version', WC_Correios::VERSION ); 
  15.  
  16. /** 
  17. * Upgrade to 3.0.0. 
  18. */ 
  19. public static function upgrade_300() { 
  20. global $wpdb; 
  21.  
  22. $version = self::get_version(); 
  23.  
  24. if ( empty( $version ) ) { 
  25. $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_correios_tracking_code' WHERE meta_key = 'correios_tracking';" ); 
  26.  
  27. /** 
  28. * Upgrade to 3.0.0 while using WooCommerce 2.6.0. 
  29. */ 
  30. public static function upgrade_300_from_wc_260() { 
  31. if ( $old_options = get_option( 'woocommerce_correios_settings' ) ) { 
  32. if ( isset( $old_options['tracking_history'] ) ) { 
  33. $integration_options = get_option( 'woocommerce_correios-integration_settings', array( 
  34. 'general_options' => '',  
  35. 'tracking' => '',  
  36. 'enable_tracking' => 'no',  
  37. 'tracking_debug' => 'no',  
  38. ) ); 
  39.  
  40. // Update integration options. 
  41. $integration_options['enable_tracking'] = $old_options['tracking_history']; 
  42. update_option( 'woocommerce_correios-integration_settings', $integration_options ); 
  43.  
  44. // Update the old options. 
  45. unset( $old_options['tracking_history'] ); 
  46. update_option( 'woocommerce_correios_settings', $old_options ); 
  47.  
  48. if ( 'no' === $old_options['enabled'] ) { 
  49. delete_option( 'woocommerce_correios_settings' );