enter image description here

We have scenario with GDex and Yamato shipping partner and our shipping cost will be changing at run-time so we don't want to allow to select shipping methods(HIDE) to customer but want to apply shipping method programmatically based on our condition. This things, we need to implement in magento 2. Thanks In advance

  • If you have only one shipping method you can hide shipping section from checkout page using css.
    – John
    Jun 29, 2017 at 6:13
  • I am having multiple shipping methods Jun 29, 2017 at 6:14

1 Answer 1


If you are not select shipping method then you are not able to place the order. Any way to achieve your task you need to follow this step:

Vendor: Vendor

ModuleName: CheckoutStep

1) Override checkout_index_index.xml in your module and define your own component in shipping step


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="checkout.root">
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shipping-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shippingAddress" xsi:type="array">
                                                    <item name="component" xsi:type="string">Vendor_CheckoutStep/js/view/krish-shipping</item>

2) Create krish-shipping.js and define your own shipping template


    ) {
        'use strict';
        return Component.extend({
            defaults: {
                template: 'Vendor_CheckoutStep/shipping'

            initialize: function () {
                var self = this;


3) Copy shipping.html





3) Remove html after class checkout-shipping-method and add Your message

<!--Shipping method template-->
<li id="opc-shipping_method"
    data-bind="fadeVisible: visible(), blockLoader: isLoading"
    <div class="checkout-shipping-method">
    <div class="step-title" data-bind="i18n: 'Shipping Methods'" data-role="title"></div>
        <div data-bind="i18n: 'Your Custom Message'" data-role="title"></div>

for reference you can check this link out

  • "If you are not select shipping method then you are not able to place the order:" can we apply shipping method at background and how we can place order without selecting shipping methods? @Riddhish Bhayani Jun 29, 2017 at 7:19
  • @PramodKharade Yes you have to set fee shipping in the background. As magento don’t allow to place order without shipping method. Jun 29, 2017 at 8:38
  • where from we can set shipping methods without showing to customer ?(File path) Jun 29, 2017 at 8:42
  • @ Riddhish Bhayani , I am having Gdex and Yamato shipping methods but I want to make it available only one shipping methods based on order sequencing logic so shipping cost will be changing based on sequence at run time . Could you please suggest me right solution ? Jul 4, 2017 at 3:47

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.