Last active
July 27, 2018 16:38
-
-
Save Auke1810/de4e09a5956242c31137e01014bddc7b to your computer and use it in GitHub Desktop.
This little script will help you to use the woocomerce multiple currencies with our woocommerce product feed manager. You are able to create several feeds with different currencies.
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
<?php | |
function alter_feed_item( $attributes, $feed_id, $product_id ) { | |
// In this example I have added the "custom_label_0" to each feed. | |
// Custom_label_0 is filled with a ISO currency code as a static value | |
// Forinstance the ISO currency code for the US is USD. | |
// uses wmc_get_price() from woocomerce multiple currencies | |
//get the correct price in the correct currency. | |
if($attributes['custom_label_0']){ | |
$attributes['price'] = wmc_get_price( $attributes['price'], $attributes['custom_label_0']). " " . $attributes['custom_label_0']"; | |
} | |
// IMPORTANT! Always return the $attributes | |
return $attributes; | |
} | |
add_filter( 'wppfm_feed_item_value', 'alter_feed_item', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment