Created
April 25, 2016 20:54
-
-
Save bentasm1/416e053a2c310182c049489369208c18 to your computer and use it in GitHub Desktop.
WC Vendors Pro - Additional Information on Ships From section
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WC Vendors Pro - Custom "Ships From" code provided by @pronet | |
* https://www.wcvendors.com/help/topic/custom-ships-from-how-to/ | |
* Say you want to show more detailed location information under single product view “Ships From” section. | |
* This will show in addition the city and state/province. | |
*/ | |
function custom_ships_from(){ | |
global $post; | |
$vendor_id = WCV_Vendors::get_vendor_from_product( $post->ID ); | |
$town = get_user_meta( $vendor_id, '_wcv_store_city', true ); | |
$county = get_user_meta( $vendor_id, '_wcv_store_state', true ); | |
if ( $town && $county && $county !='' ) { | |
$town = $town.', '.$county; | |
} elseif ( !$town && $county && $county !='' ) { | |
$town = $county; | |
} | |
if ( !$town || $town=='' ) { | |
$countries = WCVendors_Pro_Form_Helper::countries(); | |
$store_country = WC()->countries->get_base_country(); | |
$town = $countries[ strtoupper( $store_country ) ]; | |
} | |
return array( | |
'store_country' => $town, | |
'wrapper_start' => '<br /><span class="wcvendors_ships_from">', | |
'wrapper_end' => '</span><br />', | |
'title' => __( 'Ships From: ', 'wcvendors-pro' ) | |
); | |
} | |
add_filter('wcv_product_ships_from', 'custom_ships_from'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment