The WooCommerce MSRP plugin allows you to record Manufacturer Suggested Retail Prices / Recommended Retail Prices against your products, and have them displayed on the sales pages. This allows your customers to see why it’s a good idea to buy from you. You can also show them how much they’re saving – either as a monetary value, or as a percentage.
Installation
↑ Back to top
- Unzip and upload the plugin’s folder to your /wp-content/plugins/ directory
- Activate the extension through the ‘Plugins’ menu in WordPress
- Review the extension’s settings by going to WooCommerce » Settings » General and scrolling down to the “MSRP pricing options” section
Usage
↑ Back to topIt is possible to have MSRP pricing both product wide and with each individual variation.
Options
↑ Back to topShow MSRP Pricing?
↑ Back to top- Never – Never
MSRP Labelling
↑ Back to topShow savings
↑ Back to topControlling output
↑ Back to topHook re-ordering
↑ Back to topwoocommerce_single_product_summary
hook with a priority of 7. This normally places it after the title, but before the rating, and price.
If you want, you can un-hook this, and output it on a different hook, or even just at a different priority to change the location on the page. As an example, this snippet moves it after the product price:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', function () { | |
global $woocommerce_msrp_frontend; | |
remove_action( | |
'woocommerce_single_product_summary', | |
[ $woocommerce_msrp_frontend, 'show_msrp' ], | |
7 | |
); | |
add_action( | |
'woocommerce_single_product_summary', | |
[ $woocommerce_msrp_frontend, 'show_msrp' ], | |
12 | |
); | |
} ); |
Shortcodes
↑ Back to top[product_msrp_info]
The MSRP will be shown automatically for the global $product.
If the global product is not set, you can specify the product ID by adding it as a shortcode argument:
[product_msrp_info product_id="{put the desired product ID here}"]
Template functions
↑ Back to topwoocommerce_msrp_show_msrp_info()
which will output the MSRP for the global $product
if one is defined. If the global $product
variable is not defined, then you should pass in the WC_Product
object to the function, e.g.
woocommerce_msrp_show_msrp_info( $wc_product );