Skip to content

Instantly share code, notes, and snippets.

@kloon

kloon/gist:e27f982015a9819b04b6 Secret

Last active Dec 23, 2015
Embed
What would you like to do?
RRP Price Tutorial - Display price on frontend
add_action( 'woocommerce_single_product_summary', 'wc_rrp_show', 5 );
function wc_rrp_show() {
global $product;
// Do not show this on variable products
if ( $product->product_type <> 'variable' ) {
$rrp = get_post_meta( $product->id, 'rrp_price', true );
echo '<div class="woocommerce_msrp">';
_e( 'RRP: ', 'woocommerce' );
echo '<span class="woocommerce-rrp-price">' . woocommerce_price( $rrp ) . '</span>';
echo '</div>';
}
}
// Optional: To show on archive pages
add_action( 'woocommerce_after_shop_loop_item_title', 'wc_rrp_show' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.