This code hides OPC VAT field for Belgium customers and display it for everybody else. You can add this code you your tabcontent.js of your theme, or at the bottom of your onepage.unlogged.tpl.php file. This code works only for anonymous users and explains how to use OPC triggerrs:
- Code: Select all
function alterShopperFields()
{
// requires jquery
if (typeof jQuery === 'undefined') return;
var country = Onepage.op_getSelectedCountry();
//belgium has id 21, netherlands have id 150
// name of your field per VM config opc_vat
var d = jQuery('#opc_vat_div');
if (d != null)
if (typeof d.parent != 'undefined')
{
var parent = d.parent();
{
// country 21 is belgium
if (country == 21)
{
//hide opc vat field
// will hide the element
if (typeof parent.fadeOut != 'undefined')
parent.fadeOut();
else
parent.css('display', 'none');
}
else
{
if (typeof parent.fadeIn != 'undefined')
parent.fadeIn();
else
parent.css('display', 'block');
}
}
}
}
if (typeof addOpcTriggerer != 'undefined')
addOpcTriggerer("callBeforeAjax", "alterShopperFields()");
This is just an example of an easy modification of the logic of your checkout.
Best Regards, Stan