Page 1 of 1
How to get custom field show only on payment address?
Posted: Wed Feb 21, 2024 8:16 am
by septero
Hi,
On checkout form I have added VAT number custom field which is showing when customer select corresponding user group (company). In System>Localisation>Country I have added VAT field into default address format.
Everything is working ok but VAT field is showing on order confirmation on both payment and shipping addresses. How to get it show only on payment section and hide it on shipment address?
OpenCart 3.0.3.9. PHP 8.3. Default theme.
Re: How to get custom field show only on payment address?
Posted: Wed Feb 21, 2024 11:11 am
by softmonke
septero wrote: ↑Wed Feb 21, 2024 8:16 am
Hi,
On checkout form I have added VAT number custom field which is showing when customer select corresponding user group (company). In System>Localisation>Country I have added VAT field into default address format.
Everything is working ok but VAT field is showing on order confirmation on both payment and shipping addresses. How to get it show only on payment section and hide it on shipment address?
OpenCart 3.0.3.9. PHP 8.3. Default theme.
By default, if the custom field's "Location" option is set to "Address", it will appear for both payment and shipping address. Without making custom modifications, you will not be able to get the custom field to only show for payment address but hidden for shipping address. Alternatively, you can also consider setting the "Location" option to "Account" - but I'm not entirely sure if that will make sense for VAT field.
Re: How to get custom field show only on payment address?
Posted: Sun Oct 06, 2024 1:01 am
by jani90
Hello,
if I may borrow a theme.
How did you set the address format in System>Localisation>Country?
I also need to enter a VAT number.
Thank you for your reply and best regards
Re: How to get custom field show only on payment address?
Posted: Sun Oct 06, 2024 7:29 am
by softmonke
jani90 wrote: ↑Sun Oct 06, 2024 1:01 am
Hello,
if I may borrow a theme.
How did you set the address format in System>Localisation>Country?
I also need to enter a VAT number.
Thank you for your reply and best regards
Address Format in System » Localisation » Country is only for formatting the address stored in the database so that it shows up in your specified format for orders throughout your site, i.e. in Sales » Orders, invoices, shipping list, when customers view their orders, etc.
For VAT number field, your best option would be to use OpenCart's Custom Fields feature which you can manage under Customers » Custom Fields. But as mentioned above, custom fields with "Location" option set as "Address" will appear for both Payment and Shipping address. And without custom modifications or third-party extensions, it's not possible to only allow it to show up for Payment address.