Enable Search Address Book to Admin Only

        1. Go to WPCargo Address Book Settings
        2. Disable search shipper address and receiver address
        3. Copy and paste this code and add it to functions.php of your current theme:
 
add_action( 'wpc_receiver_before_content', 'mycustom_address_books_shipper_autofill' );
add_action( 'before_wpcshcon_receiver_form_fields', 'mycustom_address_books_shipper_autofill' );
add_action( 'before_wpcfe_receiver_info_form_fields', 'mycustom_address_books_shipper_autofill' );

// Shipper auto search

add_action( 'wpc_shipper_before_content', 'mycustom_address_books_receiver_autofill' );
add_action( 'before_wpcfe_shipper_info_form_fields', 'mycustom_address_books_receiver_autofill' );

function mycustom_address_books_shipper_autofill(){
    if( !is_user_logged_in() ){
        return false;
    }
    $user = wp_get_current_user();


    // Select Role to have access
    // In this case only the administrator role can have address book auto fill

    if ( !in_array( 'administrator', (array) $user->roles ) ) {
        return false;
    }
    ?></pre>
<section class="wpcabook-autofill-wrapper col-md-12">
<div id="shipper_addressbook_autofill" class="form-group"></div>
</section>
<pre>    <!--?php 

}


function mycustom_address_books_receiver_autofill(){
    if( !is_user_logged_in() ){
        return false;
    }
    $user = wp_get_current_user();


    // Select Role to have access
    // In this case only the administrator role can have address book auto fill

    if ( !in_array( 'administrator', (array) $user->roles ) ) {
        return false;
    }
    ?--></pre>
<section class="wpcabook-autofill-wrapper col-md-12">
<div id="receiver_addressbook_autofill" class="form-group"></div>
</section>
<pre>    <?php
}
0
    0
    Your Cart
    Your cart is emptyReturn to Shop