I need store country displayed on single product page

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 2 reply threads
  • Author
    Posts
    • #71005
      ing.rapparini
      Participant

      I need store country displayed on single product page as shown in this pics.
      Is it possible?

      Attachments:
      You must be logged in to view attached files.
    • #71016
      WCFM Forum
      Keymaster

      Hi,

      Please use this code for the purpose –

      add_action( 'woocommerce_product_meta_start', function() {
      	global $WCFM, $WCFMmp, $product;
      	
      	$product_id = $product->get_id();
      	$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );
      	
      	if( $vendor_id ) {
      		$store_user      = wcfmmp_get_store( $vendor_id );
      		$store_address   = $store_user->get_address(); 
      		if( $store_address && is_array( $store_address ) && !empty( $store_address ) ) {
      			$country         = isset( $store_address['country'] ) ? $store_address['country'] : '';
      			
      			if( $country ) {
      				$country_obj   = new WC_Countries();
      				$countries     = $country_obj->countries;
      				$country_name  = '';
      				if( $country ) $country_name = $country;
      				if( $country && isset( $countries[$country] ) ) {
      					$country_name = $countries[$country];
      				}
      				echo '<div class="wcfm_clearfix"></div><div class="wcfmmp_shipment_processing_display">Country: ' . $country_name . '</div><div class="wcfm_clearfix"></div>';
      			}
      		}
      	}
      }, 51 );

      Will show country here – https://ibb.co/26yZjps

      Than you

    • #71671
      ing.rapparini
      Participant

      WOW!
      THANK YOU VERY MUCH!!!

Viewing 2 reply threads
  • The topic ‘I need store country displayed on single product page’ is closed to new replies.