• Resolved myxlot

    (@myxlot)


    In ACF I have a number of custom fields that are shown based upon a number of product categories.

    For example if I have in the ‘Locations’ section :
    Show this field group if
    [Post type][is equal to][Product] {AND}
    [Post taxonomy][is equal to][-Basketball]
    {OR}
    [Post type][is equal to][Product] {AND}
    [Post taxonomy][is equal to][-Soccer]

    If I go to ‘Add Product’ from the Dokan Dashboard, it shows all fields related to this ACF group twice. If I would add a 3th location it will show 3 times in the Dokan product add/edit (the regular woocommerce ‘admin’ product edit/add does process the locations correctly). Even when none of the listed product categories has been selected yet, the ACF fields are shown 2 times for the above locations.

    Another reason why I suspect the ‘{AND}’ statements are processed as if they were an ‘{OR}’ is that when I add ‘Vendor’ as location condition, like this
    [Post type][is equal to][Product] {AND}
    [Post taxonomy][is equal to][-Basketball] {AND}
    [User role][is equal to][Vendor]
    {OR}
    [Post type][is equal to][Product] {AND}
    [Post taxonomy][is equal to][-Soccer]
    `
    , now all of the sudden the ACF fields show up in the ‘Edit Account Details’ page when I go to ‘Edit Account’ from the Dokan dashboard.

    I am using the Pro version.

    Thanks!

    • This topic was modified 3 years ago by myxlot.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author krazyplugins

    (@krazyplugins)

    Hello @myxlot

    Please share the website credentials to the [email protected] email and I will take a look at it as soon as I can.

    Thanks

    Plugin Author krazyplugins

    (@krazyplugins)

    Hello @myxlot

    This can be achieved using js, here is the example that you can use.

    jQuery(document).ready(function(){
    	//hide all custom field on load
    	jQuery(".acf-fields.acf-form-fields .acf-field").hide();
    
    	// load custom field based on the selected value
    	value = jQuery("#product_cat").val();
    	if( value == '123' ) {  // 123 is category ID
    		jQuery(".acf-fields.acf-form-fields .acf-field").hide();
    		jQuery("#acf-field_616dd9594eaaa").parents(".acf-field").show();
    	} else if( value == '200' ) { 
    		jQuery(".acf-fields.acf-form-fields .acf-field").hide();
    		jQuery(".acf-field-6169d28f41111").show();
    	} 
    
            // on product category dropdown change
    	jQuery("#product_cat").change(function(){
    		value = jQuery(this).val();
    		if( value == '123' ) { //comics 
    			jQuery(".acf-fields.acf-form-fields .acf-field").hide();
    		        jQuery("#acf-field_616dd9594eaaa").parents(".acf-field").show();
    		} else if( value == '200') { 
    			jQuery(".acf-fields.acf-form-fields .acf-field").hide();
    		        jQuery(".acf-field-6169d28f41111").show();
    		} 
    	});
    });

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘‘AND’ from ACF ‘location’ section processed as ‘OR’ ?’ is closed to new replies.