Skip to content

Instantly share code, notes, and snippets.

@Auke1810
Last active July 27, 2018 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Auke1810/de4e09a5956242c31137e01014bddc7b to your computer and use it in GitHub Desktop.
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.
<?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