jigneshkaila

Untitled

Jun 10th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. add_filter('angelleye_paypal_plus_shipping_line1', 'th_angelleye_paypal_plus_shipping_line1', 10, 2);
  2.  
  3.     function th_angelleye_paypal_plus_shipping_line1($shipping_address_1, $order_id) {
  4.         $shipping_address = get_post_meta($order_id, '_shipping_address_1', true);
  5.         if (empty($shipping_address)) {
  6.             $house_no = get_post_meta($order_id, 'hausnummer', true);
  7.         } else {
  8.             $house_no = get_post_meta($order_id, 'shipping_haus_nummer', true);
  9.         }
  10.         if (!empty($house_no)) {
  11.             $shipping_address_1 = th_limit_length($shipping_address_1 . ' ' . $house_no, 100);
  12.         }
  13.         return $shipping_address_1;
  14.     }
  15.  
  16.     function th_limit_length($string, $limit = 127) {
  17.         if (strlen($string) > $limit) {
  18.             $string = substr($string, 0, $limit - 3) . '...';
  19.         }
  20.         return $string;
  21.     }
Add Comment
Please, Sign In to add comment