Answers for "SINGLE LINE ADDRESS"

PHP
0

SINGLE LINE ADDRESS

add_action( 'woocommerce_product_meta_end', function() {
    global $product;
    $vendor_id = wcfm_get_vendor_id_by_post( $product->get_id() );
    $store_user = wcfmmp_get_store( $vendor_id );
    $store_info = $store_user->get_shop_info();
    if ( $store_info['store_hide_address'] == 'yes' || ! wcfm_vendor_has_capability( $vendor_id, 'vendor_address' ) )
        return;
    if ( ! empty( $store_info['address'] ) ) {
        $addr_arr = array();
        $all_countries = WC()->countries->get_countries();
        if ( ! empty( $store_info['address']['country'] ) && ! empty( $all_countries[$store_info['address']['country']] ) ) {
            array_push( $addr_arr, $all_countries[$store_info['address']['country']] );
            if ( ! empty( $store_info['address']['state'] ) )
                array_push( $addr_arr, $store_info['address']['state'] );
            if ( ! empty( $store_info['address']['city'] ) )
                array_push( $addr_arr, $store_info['address']['city'] );
            ?>
            <p class="vendor_singleline_address"><span>Country: </span><?php _e( implode( ", ", $addr_arr ) ); ?></p>
            <?php
        }
    }
} );
Posted by: Guest on October-29-2021

Browse Popular Code Answers by Language