Hi,
I started with an ACF File Field to display the relevant product file in our Single Product pages in WooCommerce. However, in some cases the file is an atrocious size, so I’m looking to adapt my setup to incorporate an external Link (Google Drive, Dropbox etc.
I’m unsure how to set up the context so that it only checks and outputs one field if both ever become available.
For Example;
if(ACF File === true && ACF Link === False){
//Display file in href
}
if(ACF File === false && ACF Link === true){
//Display link in href
}
}else{
//run this else only when the first 2 IFs are false
}
}
Any advice would be great.
Thanks
I would do something like this, assuming that you want the link to override the file
if (get_field('link')) {
// link for href
} elseif (get_field('flle')) {
// file url for href
}