Skip to content

Instantly share code, notes, and snippets.

@clarklab
Created January 27, 2012 02:22
Show Gist options
  • Save clarklab/1686586 to your computer and use it in GitHub Desktop.
Save clarklab/1686586 to your computer and use it in GitHub Desktop.
PHP/WordPress find discount
<?php
$deal_price = get_post_meta($post->ID, 'deal_price', true);
$old_price = get_post_meta($post->ID, 'old_price', true);
$discount = round(((1-($deal_price / $old_price))*100),0);
echo $discount.'%'; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment