Change Currency
-
Hey there, I use your Search Addon and I want to ask if there is a way to add the following functions to the search with a snippet:
function change_existing_currency_symbol( $currency_symbol, $currency) { $product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' ); if ( $product_cats && ! is_wp_error ( $product_cats ) ){ $single_cat = array_shift( $product_cats ); $cat = $single_cat; } switch($single_cat->name) { case 'Amazon US': $currency_symbol = '$ '; break; case 'Amazon GB': $currency_symbol = '£ '; break; case 'Amazon DE': $currency_symbol = '€ '; break; case 'Amazon IT': $currency_symbol = '€ '; break; case 'Amazon FR': $currency_symbol = '€ '; break; case 'Amazon ES': $currency_symbol = '€ '; break; case 'Amazon JP': $currency_symbol = '¥ '; break; } return $currency_symbol; }
function woo_custom_format_position($format, $currency_pos) { /*'left':$format = '%1$s%2$s'; 'right':$format = '%2$s%1$s'; 'left_space':$format = '%1$s %2$s'; 'right_space':$format = '%2$s %1$s'; */ $product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' ); if ( $product_cats && ! is_wp_error ( $product_cats ) ){ $single_cat = array_shift( $product_cats ); $cat = $single_cat; } switch($single_cat->name) { case 'Amazon US': $format = '%1$s%2$s'; break; case 'Amazon GB': $format = '%1$s%2$s'; break; case 'Amazon DE': $format = '%2$s %1$s'; break; case 'Amazon IT': $format = '%2$s %1$s'; break; case 'Amazon FR': $format = '%2$s %1$s'; break; case 'Amazon ES': $format = '%2$s %1$s'; break; case 'Amazon JP': $format = '%1$s %2$s'; break; } return $format; }
I use these function to format the prices in my woocommerce shop. And therefore it would be awesome to have these changes with a snippet like
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
this at the search too. Also it would be very nice to know if there is a way to show the category of the search result under the result name in small. Any help would be great. Thank you!
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Change Currency’ is closed to new replies.