Skip to content

Display the msrp price value inline on page, rather than requiring a user to interact with the page

License

Notifications You must be signed in to change notification settings

krakencommerce/magento2-module-display-msrp-inline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kraken DisplayMsrpInline Extension

Description

In Magento 1, if an admin added an msrp price, the msrp and regular price would display on the product page. Magento 2 added "Minimum Advertised Price" functionality that by default hides the regular price until you click a "Click for price" link. This extension removes that "Minimum Advertised Price" functionality and displays both the msrp and regular price.

Rather than creating this extension, we could have added a custom product attribute called something like msrp_custom and modified the templates to output that value. However we took this approach as the Magento_Msrp extension has support for updating the msrp price when configurable dropdowns are changed, and that alone justified this approach.

  • Displays the msrp price value inline on page, rather than requiring a user to interact with the page
  • Adds msrp display to grouped products (since it doesn't work natively in Magento 2.3.2)

Usage Instructions

  • Install extension (make sure you apply the patch in the patches folder)

  • Go to "STORES -> Configuration > SALES > Sales > Minimum Advertised Price" and change "Enable MAP" to "Yes"

  • Edit any product, click on "Advanced Pricing". Add a value to the "Manufacturer's Suggested Retail Price" input that is higher than the price

  • View the product on the frontend and you'll see the normal price AND the MSRP price displayed on the page:

    Image

Installation Instructions

First, apply the patch in patches/ to the magento/module-catalog module using the composer-patches plugin. More details on how to do that here.

The reason we applied this change as a patch instead of a preference is that is prevents us from copying forward multiple core methods into this plugin.

You'll need to copy the vendor/kraken/module-display-msrp-inline/patches/ files to a folder like patches/composer.

Snippet of what your composer.json file should look like after you apply the patch:

    "extra": {
        "magento-force": "override",
        "composer-exit-on-patch-failure": true,
        "patches": {
            "magento/module-catalog": {
                "Display MSRP prices in addition to other prices": "patches/composer/magento-module-catalog-display-msrp.patch"
            },
            "magento/module-swatches": {
                "Display MSRP prices when swatch options change": "patches/composer/magento-module-swatches-update-msrp-when-swatches-change.patch",
            },
        }
    }

After you do the above, ensure the vendor/magento/module-catalog/Pricing/Render/FinalPriceBox.php file has the changes in the patch file.

Option 1 - Install extension using Composer (default approach)

composer config repositories.kraken/module-display-msrp-inline git https://github.com/krakencommerce/magento2-module-display-msrp-inline.git
composer require kraken/module-display-msrp-inline:dev-master
bin/magento module:enable --clear-static-content Kraken_DisplayMsrpInline
bin/magento setup:upgrade
bin/magento cache:flush

Option 2 - Install extension by copying files into project (only if the project requires it for some reason)

mkdir -p app/code/Kraken/DisplayMsrpInline
git archive --format=tar --remote=git@github.com:krakencommerce/magento2-module-display-msrp-inline.git master | tar xf - -C app/code/Kraken/DisplayMsrpInline/
bin/magento module:enable --clear-static-content Kraken_DisplayMsrpInline
bin/magento setup:upgrade
bin/magento cache:flush

Uninstallation Instructions

These instructions work regardless of how you installed the extension:

bin/magento module:disable --clear-static-content Kraken_DisplayMsrpInline
rm -rf app/code/Kraken/DisplayMsrpInline
composer remove kraken/module-display-msrp-inline
mr2 db:query 'DELETE FROM `setup_module` WHERE `module` = "Kraken_DisplayMsrpInline"'
bin/magento cache:flush

About

Display the msrp price value inline on page, rather than requiring a user to interact with the page

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published