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' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
in which page adding these code