php - Wordpress print_r or echo from within hook callback -


i want debug function below. print_r nor echo not displaying though. how can print contents of: $order or $paypal_args ?

function custom_override_paypal_email1( $paypal_args, $order ) {     print_r($paypal_args);     print_r($order);     // die();     global $woocommerce;      foreach ( $order->get_items() $product ) {             $terms = get_the_terms($product['product_id'],'product_cat');             if (!is_null($terms)){                     if(count($terms)>0)                     {                         //get first 1                     $term = $terms[0];                   if(strtolower($catname)==='ethics'){                          $paypal_args['business'] = "zzz@zzz.example.com";                      }                      else{                         // $t = strval($term);                         $paypal_args['business'] = $t ."yyy@yyy.example.com";                      }                 }             }         //  break;         } //      $woocommerce->add_error( sprintf( "you must add minimum of %s %s's cart proceed." , 1, "t" ) );     return $paypal_args; } add_filter( 'woocommerce_paypal_args' , 'custom_override_paypal_email1', 10, 2  );  

whenever run function getting following woocommerce notice:

syntaxerror: unexpected token m in json @ position 0 

because performing ajax request, response not shown on page. echo or print_r() functions working, in order see happening ajax responses need use browser console.

you can access console on browsers pressing f12. able see http requests being made, , can examine happening them.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -