retain_val_wccs_callback

The WooCommerce Checkout Manager retain val wccs callback function.

Description

retain_val_wccs_callback(); 

Usage

  1. if ( !function_exists( 'retain_val_wccs_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/main.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = retain_val_wccs_callback(); 
  7.  

Defined (1)

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

/includes/classes/main.php  
  1. function retain_val_wccs_callback() { 
  2. global $wpdb; // this is how you get access to the database 
  3.  
  4. $options = get_option( 'wccs_settings' ); 
  5. $options2 = get_option( 'wccs_settings2' ); 
  6. $options3 = get_option( 'wccs_settings3' ); 
  7.  
  8. if (!empty($options) ) { 
  9. foreach ( $options['buttons'] as $btn ) : 
  10. if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { 
  11. if( $_POST[''.$btn['cow'].''] ) { 
  12. $saved[''.$btn['cow'].''] = $_POST[''.$btn['cow'].''];  
  13. endforeach; 
  14.  
  15. if ( WC()->cart->needs_shipping_address() === true && $_POST['ship_to_different_address'] == 1 ) : 
  16. foreach ( $options2['shipping_buttons'] as $btn ) : 
  17. if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { 
  18. if( $_POST['shipping_'.$btn['cow'].''] ) { 
  19. $saved['shipping_'.$btn['cow'].''] = $_POST['shipping_'.$btn['cow'].''];  
  20. endforeach; 
  21. endif; 
  22.  
  23. foreach ( $options3['billing_buttons'] as $btn ) : 
  24. if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { 
  25. if( $_POST['billing_'.$btn['cow'].''] ) { 
  26. $saved['billing_'.$btn['cow'].''] = $_POST['billing_'.$btn['cow'].''];  
  27. endforeach; 
  28.  
  29. WC()->session->set('wooccm_retain', $saved ); 
  30.  
  31. die();  
  32.  
  33. } // end function retain_val_wccs_callback()