Start a new topic

Hiding the shipping amount if 0

I would like to hide the shipping line on the totals if it is 0


I feel like I am on the right track with this script but I must have something wrong as it's not working. Is anyone able to help? Thanks


   

<script type="text/javascript">
var shipamount ="[DH_AlternateShippingAmount]";
if (shipamount.value == "0") {
        document.getElementById('shippingline').style.display="none";
    } else {
        document.getElementById('shippingline').style.display="block";
    }
}
</script>
 
<tr class="row-shipping" id="shippingline">
            <td class="col-description">
                Shipping:
            </td>
            <td class="col-amount">
                [DH_AlternateShippingAmount:f=1]
            </td>
</tr>

   

1 Comment

  

function HideShippingTest(shippingAmount) {    
    if (shippingAmount == 0) {
        $("tr.row-shipping:last").html("");
    }    
}

   

                    <tr class="row-shipping">
                        <td class="col-description">
                            Shipping:
                        </td>
                        <td class="col-amount">
                            [DH_ShippingAmount:f=1]
                        </td>
                    </tr>
                    <script>HideShippingTest('[DH_ShippingAmount]');</script>

 

Login or Signup to post a comment