Skip to content

Instantly share code, notes, and snippets.

@fatihtoprak
Last active January 2, 2016 02:09
Show Gist options
  • Select an option

  • Save fatihtoprak/8235157 to your computer and use it in GitHub Desktop.

Select an option

Save fatihtoprak/8235157 to your computer and use it in GitHub Desktop.
update post meta
<?php
function save_urun_meta_price( $post_id ) {
// - Update the post's metadata.
if ( isset( $_REQUEST['urun_indirimli_fiyat'] ) ) {
$product_price = get_post_meta( $post_id, 'urun_fiyat', true );
$product_discount = of_get_option('urun_discount');
$yuzde = ($product_discount / 100)*$product_price;
$discounted = $product_price-$yuzde;
update_post_meta( $post_id, 'urun_indirimli_fiyat', $discounted );
}
}
add_action( 'save_post', 'save_urun_meta_price' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment