Receipt Or Invoice - Checkout Option

Hello,

some months ago, someone someone wrote me a code (obviously not an expert) at checkout of my eshop, to choose between receipt or invoice with radio code. This never worked.

Can someone help me to find the mistakes and correct it? Im not an expert so please explain with details.

Here is the code:

$(document).ready(function() {

if ( $('#elm_1_2').is(':checked')) {

$(".billing-company").show();

$(".billing-job").show();

$(".billing-afm").show();

$(".billing-doy").show();

} else {

$(".billing-company").hide();

$(".billing-job").hide();

$(".billing-afm").hide();

$(".billing-doy").hide();

}

$("input[name='user_data[fields][1]']").click(function(){

var test = $(this).val();

if (test=='1') {

$(".billing-company").hide();

$(".billing-job").hide();

$(".billing-afm").hide();

$(".billing-doy").hide();

} else {

$(".billing-company").show();

$(".billing-job").show();

$(".billing-afm").show();

$(".billing-doy").show();

}

});

});

and that is the website pc-evolution.gr

Try this one:

$(document).ready(function() {
              if ( $('#elm_80_2').is(':checked')) {
                             $(".billing-company").show();
                             $(".billing-job").show();
                             $(".billing-afm").show();
                             $(".billing-doy").show();
              } else {
                             $(".billing-company").hide();
                             $(".billing-job").hide();
                             $(".billing-afm").hide();
                             $(".billing-doy").hide();
              }
          $("input[name='user_data[fields][80]']").click(function(){
                         var test = $(this).val();
                         if (test=='1') {
                                       $(".billing-company").hide();
                                       $(".billing-job").hide();
                                       $(".billing-afm").hide();
                                       $(".billing-doy").hide();
                         } else {
                                       $(".billing-company").show();
                                       $(".billing-job").show();
                                       $(".billing-afm").show();
                                       $(".billing-doy").show();
                         }
          });

});

After some editing/deleting it now works.

Some last question, what edit i must do, to be default the other option (receipt) than this now (invoice)?

More specific i want to be choosen the receipt and only when they choose invoice the fields to be appear.

Thank you for your time and effort eCom..

After some editing/deleting it now works.

Some last question, what edit i must do, to be default the other option (receipt) than this now (invoice)?

More specific i want to be choosen the receipt and only when they choose invoice the fields to be appear.

Thank you for your time and effort eCom..

What do you mean by "receipt than invoice"? Please clarify

The code above by default has checked the "invoice" option. I want to modify this and by default to have the "receipt" option checked instead.

Also, for a strange reason, it stopped working. It might be a bug or need more modification to work properly..

The code above by default has checked the "invoice" option. I want to modify this and by default to have the "receipt" option checked instead.

Just change variant position of the corresponding field in the admin panel

Also, for a strange reason, it stopped working. It might be a bug or need more modification to work properly..

If you use script tag to add the code, add class="cm-ajax-force" to it

I dont know what you mean by that, i searched the internet but no help.

The only sure i can tell you, is that if i sign in and go as a registered customer to basket/check out it works.

But if i go as a guest to check out, it doesnt work.

I dont know what you mean by that, i searched the internet but no help.

The only sure i can tell you, is that if i sign in and go as a registered customer to basket/check out it works.

But if i go as a guest to check out, it doesnt work.

How the code is inserted to your store? Do you see the HTML tag before the first line of code?