Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. /**
  2. * Defaults customer meta for shipping same as billing.
  3. *
  4. * Means that by default we say that billing and shipping match so just hide the stuff
  5. * about shipping unless the user unselects the box.
  6. *
  7. * @author SFNdesign, Curtis McHale
  8. * @link sfndesign.ca
  9. *
  10. * @param null $value A null flag.
  11. * @param string $key The meta key being passed to the customer meta API.
  12. * @param int $id The current user/customer/visitor ID.
  13. * @return string|null The meta value, or null, if unmodified.
  14. */
  15. function elite_default_same_billing( $value, $key = '', $id = '' ) {
  16.  
  17. remove_filter( 'wpsc_get_visitor_meta_shippingSameBilling', __FUNCTION__, 15 );
  18.  
  19. $current_value = wpsc_get_customer_meta( 'shippingSameBilling' );
  20.  
  21. add_filter( 'wpsc_get_visitor_meta_shippingSameBilling', __FUNCTION__, 15 );
  22.  
  23. if ( '' !== $current_value ){
  24.  
  25. } else {
  26. $value = 'on';
  27. }
  28.  
  29. return $value;
  30.  
  31. }
  32. add_filter( 'wpsc_get_visitor_meta_shippingSameBilling', 'elite_default_same_billing', 15, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement