Differing checkout fields for Free and Paid content

Hi Team,

I am using the code below so that customers will not be required to enter personal information when downloading our free content.

However, I do not want this to be so when someone is actually purchasing when using their credit card (I would like them to enter at least a name and address when making a purchase)

Is there anyway to have both these at the same time? ( that is - not being forced to enter personal info for the free content but being required to do so if making a credit card purchase)

Thanks in advance

// FUNCTIONS TO MAKE CHECKOUT FIELDS OPTIONAL
  add_filter( 'woocommerce_billing_fields', 'wc_optional_billing_fields', 10, 1 );
  function wc_optional_billing_fields( $address_fields ) {
    $address_fields['billing_first_name']['required'] = false;
    $address_fields['billing_last_name']['required'] = false;
    $address_fields['billing_company']['required'] = false;
    $address_fields['billing_address_1']['required'] = false;
    $address_fields['billing_address_2']['required'] = false;
    $address_fields['billing_city']['required'] = false;
    $address_fields['billing_postcode']['required'] = false;
    $address_fields['billing_country']['required'] = false;
    $address_fields['billing_state']['required'] = false;
    $address_fields['billing_phone']['required'] = false;
        return $address_fields;
  }


Hello,

It looks like this issue requires some coding and testing, this goes beyond our support policy. It’s considered advanced customization. As an option, you can contact Codeable for this kind of service, or find a reputable freelancer on Upwork. Hope for your understanding.

Kind Regards, Roman.
aThemes Support

Hey Roman,

Thanks for your reply. I will check with one of the above entities.

Cheers

You are welcome!

Please feel free to ask any other questions that you might have in future.

Kind Regards, Roman.
aThemes Support