Skip to content

Instantly share code, notes, and snippets.

@kloon

kloon/gist:f09ceecfd96aaa0afcbc Secret

Last active Dec 23, 2015
Embed
What would you like to do?
RRP Tutorial - Save Product Field
add_action( 'save_post', 'wc_rrp_save_product' );
function wc_rrp_save_product( $product_id ) {
// If this is a auto save do nothing, we only save when update button is clicked
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if ( isset( $_POST['rrp_price'] ) ) {
if ( is_numeric( $_POST['rrp_price'] ) )
update_post_meta( $product_id, 'rrp_price', $_POST['rrp_price'] );
} else delete_post_meta( $product_id, 'rrp_price' );
}
@rakesh-baikar

This comment has been minimized.

Copy link

@rakesh-baikar rakesh-baikar commented Mar 26, 2015

in which page adding these code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment