How to add additional Field in checkout page, if different Delivery method

Started by kostianev, April 24, 2019, 11:19:13 AM

Previous topic - Next topic

kostianev

Dear Friends, we have this issue, if client choose Delivery to the Courier office, we need to display additional field, where to type the Office address and name. How can we achieve this?

So, for example, we have 2 Delivery methods - 1. To the Client address, where everything is okay because they fill out their address, 2. Method to the Office - where the client need to fill out the Office address, or Name

Jörgen

Let the customer register a second shipping address. You can store as many adresses as You like.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

kostianev

No, I don`t want to ask them for second address, I just need 1 input field.

Jörgen

??? Then use the input field You have if You do not need any extra address.

I would use the native shipping address.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

GJC Web Design

hide/show field by JS depending on the shipping method chosen

you can also set if required by JS -- something like


<script>
jQuery(document).ready(function($){
<?php if(//detect the shipping id == 2) { ?>
                                $('#company_field').show().addClass('required').attr('required', 'required').attr('aria-required', 'true');

<?php }else{ ?>
                              $('#company_field').hide().removeClass('required').removeAttr('required aria-required').val('');
<?php ?>
});
</script>


prob need to hide the surrounding div/row as well
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation