Created
October 18, 2022 19:00
-
-
Save jrick1229/0d8f6f39fba9d889b73880f3cc70b7f2 to your computer and use it in GitHub Desktop.
Round product price to nearest whole number based on an array of product IDs.
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 | |
add_filter( 'raw_woocommerce_price', 'wcpb_round_to_nearest_whole_number' ); | |
function wcpb_round_to_nearest_whole_number( $price ){ | |
global $post; | |
$post_ID = $post->ID; | |
$page_id = array('123','345','398','80'); | |
if(in_array($post_ID, $page_id)) { | |
return round( $price ); | |
} else { return $price; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment