I want to add the custom js file to the checkout page. please let me know where to place the file with an example.


1 Answer 1


For Add Custom Javascript after your checkout page loaded successfully,

You need to use Knockout afterRender() function for accomplishing your task.

By Default, If you have called any javascript code in the checkout page, They don't give guarantee for load after page content loading completed.

You can refer Blog, Load Javascript code after Checkout page render completed Magento 2

afterRender() function in Knockout Js used to perform the js action after knockout DOM loaded completed.

Above Blog will help you to sort out your query for checkout page.

  • Hi @Rakesh Jesadiya I am looking to target the city field in checkout page to block the certain products shipping for all cities. for this to achieve where should I place the js code file in the folder path. Dec 8, 2018 at 6:25
  • @RakeshJesadiya: Can you explain in deail that how will use this function in our custom js file. Apr 19, 2021 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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