Last active
March 8, 2022 05:48
-
-
Save Auke1810/ae4363b10681af252a02f9c0aafcec30 to your computer and use it in GitHub Desktop.
In this example we changed the price attribute and rounded the price with the round() function.
This file contains hidden or 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 | |
// Round the price | |
function round_price( $data, $feed_id, $product_id ) { | |
// round price. | |
$round_price = round($data['price'], 2); | |
// Store the rounded price in the feed price element. | |
$data['price'] = $round_price; | |
// Always return data! | |
return $data; | |
} | |
add_filter( 'wppfm_feed_item_value', 'round_price', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment