I'm able to use this city dropdown plugin successfully.

Now I'm trying to call shipping vendor API in my custom shipping module.

Can anyone help me how I can print / echo / debug the destination in Vendor\Module\Model\Carrier\CustomCarrier -> collectRates(RateRequest $request) method / any JS class when user select their region / city ?

I've tried showing the RateRequest properties following this answer with :

but still not visible , and the application mode has been set to developer as well previously.

Any help is appreciated. Thank you in advance.

Edit : I'm trying to get the destination value when the user select region / city. So the shipping price will change dynamically.

1 Answer 1


You can create custom log file to debugging. this is a alternative method.

$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/my_debug.log');
$logger = new \Zend_Log();
$logger->info('This Is Simple Text Log'); //To print simple text log
$logger->info(print_r($myarray, true)); //To print array log

Write data into custom log file and check it via manual or CLI like

tail -f var/log/my_debug.log

After debugging, delete the custom log file.

  • Hi thank you for answering. The code is only working when the page is loaded, so only the simple text log is visible. How do I make it work when I select the State / City ?
    – dinotame
    Commented Jul 14, 2023 at 7:04
  • You can add this code in PHTML files and PHP file like block, controller etc.
    – MP Raj
    Commented Jul 14, 2023 at 9:40
  • Also, you can use Ajax Request on the selection of city drop-down to trigger what the destination value you have selected. Or use the submit $request object in Logs to change the shipping price where the object property can be changed. Commented Jul 14, 2023 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.