Skip to content

Instantly share code, notes, and snippets.

Last active Dec 23, 2015
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 )
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' );
Copy link

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