I want to add multiple shipping methods on the checkout page based on my needs, now there is only one method with international shipping, but I want to add more custom dynamic shipping methods
Any idea, how to do this?
There is a free and open-source extension that supports display multiple custom shipping methods: "MatrixRate Table Rate Shipping".
It is compatible with Magento version >= 2.3 and available on both Magento marketplace and Github. The code in Github is more up-to-date than version on Magento Marketplace.
You can use this extension or if you want to build your own module, you can investigate how they build the features.
Link extension on Magento Marketplace: https://marketplace.magento.com/webshopapps-module-matrixrate.html
Link extension on Github: https://github.com/webshopapps/module-matrixrate
To add multiple custom dynamic shipping methods to the checkout page in Magento 2.4.5, you will need to follow these steps:
Create a new module for your shipping method. This will allow you to customize the shipping method and integrate it with Magento's core shipping functionality.
Define the shipping method in your module's etc/di.xml file. This will allow Magento to recognize your shipping method as a valid option.
Create a model for your shipping method. This model will define the logic and functionality of your shipping method, including how it calculates rates and handles errors.
Create a block class for your shipping method. This block class will handle the rendering of your shipping method on the checkout page and will allow you to customize the appearance and behavior of your shipping method.
Create a layout file for your shipping method. This layout file will define the layout of your shipping method on the checkout page and will allow you to specify which block class should be used to render the shipping method.
Clear the cache and test your shipping method. You should now be able to see your custom shipping method on the checkout page.
By following these steps, you should be able to add multiple custom dynamic shipping methods to the checkout page in Magento 2.4.5. It is important to note that this process can be complex and may require a strong understanding of Magento's core architecture and customization techniques. It is recommended to seek guidance from a developer with experience in Magento development if you are unsure how to proceed.