wooccm_shipping_fields

The WooCommerce Checkout Manager wooccm shipping fields function.

Description

wooccm_shipping_fields( $fields ); 

Parameters (1)

0. $fields
The fields.

Usage

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

Defined (1)

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

/includes/classes/field_filters.php  
  1. function wooccm_shipping_fields( $fields ) { 
  2. $options2 = get_option( 'wccs_settings2' ); 
  3.  
  4. foreach ( $options2['shipping_buttons'] as $btn ) : 
  5.  
  6. if ( !empty( $btn['cow']) && empty($btn['deny_checkout']) ) { 
  7.  
  8. if ( $btn['cow'] == 'country' ) { 
  9. $fields['shipping_'.$btn['cow'].'']['type'] = 'wooccmcountry'; 
  10. } elseif ( $btn['cow'] == 'state' ) { 
  11. $fields['shipping_'.$btn['cow'].'']['type'] = 'wooccmstate'; 
  12. } else { 
  13. $fields['shipping_'.$btn['cow'].'']['type'] = ''.$btn['type'].''; 
  14.  
  15. if ( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) { 
  16. $fields['shipping_'.$btn['cow'].'']['placeholder'] = ''.$btn['placeholder'].''; 
  17.  
  18. $fields['shipping_'.$btn['cow'].'']['class'] = array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].'');  
  19. $fields['shipping_'.$btn['cow'].'']['label'] = wpml_string_wccm_pro(''.$btn['label'].''); 
  20. $fields['shipping_'.$btn['cow'].'']['clear'] = ''.$btn['clear_row'].''; 
  21. $fields['shipping_'.$btn['cow'].'']['default'] = ''.$btn['force_title2'].''; 
  22. $fields['shipping_'.$btn['cow'].'']['options'] = ''.$btn['option_array'].''; 
  23. $fields['shipping_'.$btn['cow'].'']['user_role'] = ''.$btn['user_role'].''; 
  24. $fields['shipping_'.$btn['cow'].'']['role_options'] = ''.$btn['role_options'].''; 
  25. $fields['shipping_'.$btn['cow'].'']['role_options2'] = ''.$btn['role_options2'].''; 
  26. $fields['shipping_'.$btn['cow'].'']['required'] = false; 
  27. $fields['shipping_'.$btn['cow'].'']['wooccm_required'] = ''.$btn['checkbox'].''; 
  28. $fields['shipping_'.$btn['cow'].'']['cow'] = ''.$btn['cow'].''; 
  29. $fields['shipping_'.$btn['cow'].'']['color'] = ''.$btn['colorpickerd'].''; 
  30. $fields['shipping_'.$btn['cow'].'']['colorpickertype'] = ''.$btn['colorpickertype'].''; 
  31. $fields['shipping_'.$btn['cow'].'']['order'] = ''.$btn['order'].''; 
  32. $fields['shipping_'.$btn['cow'].'']['fancy'] = ''.$btn['fancy'].''; 
  33.  
  34. if ( !empty($btn['disabled']) ) { 
  35. unset($fields['shipping_'.$btn['cow'].'']); 
  36. }  
  37. endforeach; 
  38.  
  39. $fields[] = uasort($fields, 'sort_fields'); 
  40.  
  41. if ($fields[0]) { 
  42. unset($fields[0]); 
  43. return $fields;