Snippets

Cazimoon Elementor - shows the RRP above our product prices on our woocommerce store

Created by Cazimoon

File snippet.txt Added

  • Ignore whitespace
  • Hide word diff
+add_shortcode( 'single_product_summary', function () {
+	global $product;
+	$output = '';
+
+	if ( $product && $product->get_type() <> 'variable' && $rrp = get_post_meta( $product->get_id(), 'rrp', true ) ) {
+		$output .= '<div class="woocommerce_rrp">';
+		$output .= __( 'RRP: ', 'woocommerce' );
+		$output .= '<span>' . wc_price( $rrp ) . '</span>';
+		$output .= '</div>';
+	}
+	
+	return $output;
+} );
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.