Jump to content

Disable shipping for product with specific id


Recommended Posts

Hello , I need to disable the shipping section for a specific product , it's a standard product but I need it to behave like a virtual one.
meaning that if that product exists by itself in the cart , when the user is checking out they won't see the shipping section at all. 

which files should I modify to achieve this ? 

Thank you 

Link to comment
Share on other sites

Thank you , I will try it and let you know if it worked
however I'm wondering if this will  hide the shipping section from the checkout process ? 
also , what will happen if that product exists in the cart with other products ? 
 

Link to comment
Share on other sites

Just now, QuickUpdate.net said:

It will not hide it probably by the cost of shipping for the respective products would be 0

Oh  , well I got the free shipping figured out actually  but it's not the solution I'm looking for :( 
I need the shipping section to not be visible when the customer is only buying this product , I'm basically  looking for how to add the shipping "behaviour" of a virtual product to a certain standard product , I tried commenting the shipping section in the shipping.tpl file and although that hides the shipping section , it also stops the checkout process from working properly because the customer can't advance to the payment section without filling out the shipping section ( this is the case for a standard product , for a virtual product this section doesn't exist at all ) 
Thank you for your help ❤️ , if you have any idea on how to do this  I can use some guidance as I'm not sure which files to modify to achieve this behaviour 

Link to comment
Share on other sites

Just now, QuickUpdate.net said:

Post the code you commented out maybe we can figure a solution

<div class="delivery-options-list">
    {if $delivery_options|count}
      <form class="clearfix" id="js-delivery"
        data-url-update="{url entity='order' params=['ajax' => 1, 'action' => 'selectDeliveryOption']}" method="post">
        <div class="form-fields">
          {block name='delivery_options'}
            <div class="delivery-options">
              {foreach from=$delivery_options item=carrier key=carrier_id}
                <div class="row delivery-option">
                  <div class="col-sm-1">
                    <span class="custom-radio float-xs-left">
                      <input type="radio" name="delivery_option[{$id_address}]" id="delivery_option_{$carrier.id}"
                        value="{$carrier_id}" {if $delivery_option == $carrier_id} checked{/if}>
                      <span></span>
                    </span>
                  </div>
                  <label for="delivery_option_{$carrier.id}" class="col-sm-11 delivery-option-2">
                    <div class="row carrier{if $carrier.logo} carrier-hasLogo{/if}">
                      <div class="col-sm-5 col-xs-12">
                        <div class="row">
                          {if $carrier.logo}
                            <div class="col-xs-3 carrier-logo">
                              <img src="{$carrier.logo}" alt="{$carrier.name}" />
                            </div>
                          {/if}
                          <div class="carriere-name-container {if $carrier.logo}col-xs-9{else}col-xs-12{/if}">
                            <span class="h6 carrier-name">{$carrier.name}</span>
                          </div>
                        </div>
                      </div>
                      <div class="col-sm-4 col-xs-12">
                        <span class="carrier-delay">{$carrier.delay}</span>
                      </div>
                      <div class="col-sm-3 col-xs-12">
                        <span class="carrier-price">{$carrier.price}</span>
                      </div>
                    </div>
                  </label>
                </div>
                <div class="row carrier-extra-content" {if $delivery_option != $carrier_id} style="display:none;" {/if}>
                  {$carrier.extraContent nofilter}
                </div>
              {/foreach}
            </div>
          {/block}
          <div class="order-options">
            <div id="delivery">
              <label
                for="delivery_message">{l s='If you would like to add a comment about your order, please write it in the field below.' d='Shop.Theme.Checkout'}</label>
              <textarea rows="2" cols="120" id="delivery_message"
                name="delivery_message">{if isset($delivery_message)}{$delivery_message}{/if}</textarea>
            </div>
            {if $recyclablePackAllowed}
              <label>
                <input type="checkbox" name="recyclable" value="1" {if $recyclable} checked {/if}>
                <span>{l s='I would like to receive my order in recycled packaging.' d='Shop.Theme.Checkout'}</span>
              </label>
            {/if}
            {if $gift.allowed}
              <span class="custom-checkbox">
                <input class="js-gift-checkbox" name="gift" type="checkbox" value="1" {if $gift.isGift}checked="checked"
                  {/if}>
                <span><svg class="svgic svgic-done">
                    <use xlink:href="#si-done"></use>
                  </svg></span>
                <label>{$gift.label}</label>
              </span>

              <div id="gift" class="collapse{if $gift.isGift} in{/if}">
                <label
                  for="gift_message">{l s='If you\'d like, you can add a note to the gift:' d='Shop.Theme.Checkout'}</label>
                <textarea rows="2" cols="120" id="gift_message" name="gift_message">{$gift.message}</textarea>
              </div>

            {/if}
          </div>
        </div>
        <button type="submit" class="continue btn btn-primary pull-xs-right" name="confirmDeliveryOption" value="1"
          style="background-color: #04a6bc;color:white;border-radius:5px;border-color:#04a6bc;font-family: 'Open Sans';text-transform: inherit;letter-spacing: 0px;font-weight: bold;font-size: 13px;">
          {l s='Continue' d='Shop.Theme.Actions'}
        </button>
      </form>
    {else}
      <p class="alert alert-danger">
        {l s='Unfortunately, there are no carriers available for your delivery address.' d='Shop.Theme.Checkout'}</p>
    {/if}
  </div>

this is the code I commented out , 
I suppose if it's possible to check if there's only the one specific product in the cart , I can add a default carrier and not show all this , that would probably work 
I only commented this part to see if it's the one I need to work on or not and apparently it is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...