This post is a resolution this thread that includes the setup and implementation of conditionally showing the Purchase Order field on checkout using FoxEE + FoxyCart. This is the basic setup and it works pretty well if you are forcing users to login prior to going to foxycart for checkout and if you can live without having a shipping phone field (which I do not really have a need for). I hope this helps others in setup.
FoxEE Setup:
1. You must force the user to login on the EE side before you checkout. You can accomplish this by using the custom add to cart foxEE tag and using a hidden input redirect to redirect the user to a EE custom login/checkout page. Make sure to turn FoxyBox Off. You can turn it on later once you force the user to login and/or if you want the ability to update quantity of the items in the cart. I didn’t really have time to figure out how to update quantity using foxEE tags.
2. Create a custom profile field called purchase order under the members and groups section. I use a straight text field and use either 0 or 1 in that field. 0 for false, 1 for true.
3. FoxEE Module—> General Settings—> Click “Automatically Create and Map Member Fields”
4. FoxEE Module—> General Settings —> Change the radio button for “Shipping Fields are the same?” = “No”
5. Map the shipping phone field to the purchase order field created in step 2.
6. Go to the member and click on edit profile. Set the member custom profile field.
FoxyCart Setup:
1. Enable purchase order purchase in the payment settings
2. Add the following code to the checkout template right above the </head> tag. Add script tags around the below code.
jQuery(document).ready(function() {
var purchase_order = parseInt(jQuery('input[name=shipping_phone]').val());
window.alert( $('input[name=shipping_phone]').val());
if (purchase_order == 0) {
FC.checkout.config.storeDetails.supportsPurchaseOrder = false;
} else {
FC.checkout.config.storeDetails.supportsPurchaseOrder = true;
}
});
3. Css hide the Shipping Phone Field using the CSS override documented on the foxycart site.