0

Is it possible to make the Tax/VAT number field required in checkout page, if order total was more than x? How?

Thanks

1 Answer 1

1

You can achieve this with the following:

  1. Copy app/design/frontend/base/default/template/checkout/onepage/billing.phtml and/or app/design/frontend/base/default/template/checkout/onepage/shipping.phtml to your template folder

  2. add the check on the total value (subtotal, grand total,..) in the class attribute and change YOUR_TOTAL_AMOUNT to the total amount which you need as limit:

    <?php echo $this->getQuote()->getGrandTotal() >= YOUR_TOTAL_AMOUNT ? "required" : ""; ?>

The code of your input-form should look like this now:

<input type="text" 
 id="billing:vat_id"
 name="billing[vat_id]" 
 value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" 
 title="<?php echo $this->__('VAT Number') ?>" 
 class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?> <?php echo $this->getQuote()->getGrandTotal() >= YOUR_TOTAL_AMOUNT ? "required" : ""; ?>" />

I didn't test it, but I think it should work #yolo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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