Impleneted search by country, and added mesurment unit

This commit is contained in:
Nedim Uka
2018-10-10 14:09:31 +02:00
parent c8ed5f7ff8
commit 071c549726
13 changed files with 551 additions and 2 deletions

View File

@@ -114,12 +114,25 @@ class Wiaas_Countries {
*
* @return array|null
*/
public static function get_product_country($product) {
public static function get_product_country($product) {
$product_country = get_the_terms($product->get_id(), 'product_country');
return is_array($product_country) && isset($product_country[0]) ?
self::$available_countries[$product_country[0]->name] :
null;
}
/**
* Retrieves country term id from db for provided product
* @param $product
*
* @return int|null
*/
public static function get_product_country_term_id($product) {
$product_country = get_the_terms($product->get_id(), 'product_country');
return is_array($product_country) && isset($product_country[0]) ?
$product_country[0]->term_id :
null;
}
}
Wiaas_Countries::init();