Theme integration
What it does
HidePrice Pro puts its elements into the product page and the product cards of your theme: the price replacement, the Add to Cart replacement and the price request button (its text is Ask for Price by default). The Developer settings tell it where. Their defaults fit the Luma theme. In a custom theme whose markup differs, you set your own CSS selectors here, add classes to the request button and, if needed, override the module's templates.
How the replacement is placed
On Luma, HidePrice Pro hooks into Magento's price box: after the price box of a product renders, it adds the price replacement, the Add to Cart replacement and the request button to its output. A product page renders several price boxes of its product (a bundle has one per price display); the elements are added once.
Each element is first rendered hidden next to the price. When the page has loaded, a small script moves it:
- In a product list, it looks for the first element that matches the listing selector inside the product card (the nearest
.product-item) and moves the element there. It also removes the card's "In stock" label from.actions-primary. - On the product page, it looks for the first element that matches the view selector in the whole page.
- If nothing matches, the element stays where the price is and becomes visible there.
The price request button has one more rule in product lists. Keep the default of Product Listing Price Request Button Selector in the Price Request Form group, and the button takes the place of a hidden Add to Cart button. So all cards line up. On cards that keep their Add to Cart button, it stays by the price. Once you enter your own selector, it is used on every card.
Before you start
- You need admin access to Stores → Configuration and a developer who can read your theme's HTML in the browser's developer tools.
- Know your theme: Luma or a theme based on it, or Hyvä with the HidePrice Pro companion module (see Installation).
- The settings are per store view. Switch Scope first if only one store view uses the custom theme.
Steps
Set the selectors
-
Go to Stores → Configuration → MageMe Extensions → HidePrice.
-
Expand Developer.
-
On a category page and a product page of your theme, find the element each replacement should go into. Copy a CSS selector that matches it once per product card, or once per product page.
-
Enter the selectors in the three groups. Leave a field at its default where your theme uses the Luma markup.

-
Click Save Config.
-
If Magento asks you to refresh the cache, refresh the outdated cache types in System → Tools → Cache Management.
| Group | Setting | Default (Luma) | Where the element goes |
|---|---|---|---|
| Price Replacement | Product Listing Price Selector | .product-item-details:nth-of-type(2) | The price replacement in a product card. |
| Price Replacement | Product View Price Selector | .product-info-price | The price replacement on the product page. |
| Add To Cart Button Replacement | Product Listing Price Request Button Selector | .actions-primary | The Add to Cart replacement in a product card. |
| Add To Cart Button Replacement | Product View Price Request Button Selector | .product-add-form | The Add to Cart replacement on the product page. |
| Price Request Form | Product Listing Price Request Button Selector | .product-item-details:nth-of-type(2) | The price request button in a product card. See the rule above. |
| Price Request Form | Product View Price Request Button Selector | .product-add-form | The price request button on the product page. |
The two settings of the Add To Cart Button Replacement group carry "Price Request Button" in their labels, but they place the Add to Cart replacement. Every selector field can be reset to its default. All settings of each group, with their scope, are listed in Settings: Developer: Price Replacement, Add To Cart Button Replacement and Price Request Form.
Add classes to the request button
- In the Price Request Form group of Developer, enter your theme's button classes in Custom Request Button CSS Classes, separated by spaces.
- Click Save Config.
The classes become the class attribute of the price request button. The field is empty by default, and the button then has no class of its own. With action primary on Luma, the button takes Luma's primary button style.
Override a template on Luma
The module's storefront templates live in view/frontend/templates of MageMe_HidePricePro. To change one, copy it to app/design/frontend/YourVendor/your-theme/MageMe_HidePricePro/templates/ under the same path and edit the copy.
| Template | What it renders |
|---|---|
text.phtml | The Text replacement. |
alert-button.phtml | The Button With Alert replacement and its dialog. |
authentication-button.phtml | The Authentication Button (sign-in button) replacement. |
auth/form.phtml | The sign-in form the authentication button opens. |
request-button.phtml | The price request button. |
element-positioner.phtml | The hidden container and the script that moves an element to its selector. |
request/popup.phtml, request/form.phtml, request/form/script.phtml, request/form/submit.phtml, request/success.phtml | The price request popup, its form, its script, the submit button and the success message. |
request/form/field/*.phtml | The standard form fields: email, firstname, lastname, message, phone_number, file_attachments. |
request/form/custom_field/*.phtml | The custom field types: text, dropdown, radio, checkbox, date. |
Keep the element ids and data attributes of element-positioner.phtml and request-button.phtml: the scripts find the elements by them. After an update of HidePrice Pro, compare your copies with the new templates.
Hyvä themes
On Hyvä, the companion module Hyva_MageMeHidePricePro does the storefront work:
- Where it hooks in. It adds the price replacement, the Add to Cart replacement and the request button after Hyvä's product price block renders, and checks each product's HidePrice rules before a product block renders.
- Its own templates. It registers itself with Hyvä's compatibility module fallback for
MageMe_HidePricePro. In a Hyvä theme the companion's templates are used in place of the base module's Luma templates of the same name. It has its own copies of the Button With Alert and Authentication Button replacements, the request button, the positioner and the form, plus its own form validation, product list stock status and dialog templates. The Text replacement, the sign-in form and the popup use the base module's templates. To change one of them in your theme, copy it toapp/design/frontend/YourVendor/your-theme/MageMe_HidePricePro/templates/under the same path: Hyvä looks up these templates by the base module's name. The form validation, stock status and dialog templates (request/form/validation.phtml,product/list/stock-status.phtml,dialog-close.phtml,page/js/dialog-classes.phtml) are the companion's own and go underHyva_MageMeHidePricePro/templates/instead. - Tailwind. Since companion 2.1.4, its
view/frontend/tailwind/tailwind.config.jslets your theme's Tailwind build scan the companion templates. Rebuild your theme's CSS after you install or update the companion, or classes the form uses may be missing. See The form looks unstyled on Hyvä. - Placement. The same Developer selectors apply, inside a product card (
.item.product.product-item) or the whole product page. Since companion 2.1.6, an element whose selector matches nothing shows by the price as soon as the page loads, not only once it scrolls into view. - Form styling. The classes of the form fields are set in Settings: Hyvä Theme; how to use them is in Hyvä theme settings.
What you should see
- In a category list, each card with a hidden price shows the replacement in the element your listing selector names, and nothing by the price.
- On a product page, the replacement and the price request button sit in the elements your view selectors name.
- An element whose selector matches nothing shows by the price instead. If you see it there, the selector doesn't match your theme's markup.
- The price request button carries the classes from Custom Request Button CSS Classes.
Limits
- The elements are moved by a script when the page has loaded. Until then they stay hidden, and without JavaScript they stay by the price.
- A selector is matched inside each product card, or once on the product page. One selector can't serve two different card layouts in the same store view.
- Strict Content Security Policy is not supported. The storefront templates include inline scripts. On Luma they are plain inline scripts; the Hyvä companion registers its inline scripts with Hyvä's CSP helper. A store that blocks all inline scripts is not supported and not tested. See Compatibility.
- Template copies in your theme don't receive fixes from module updates.
Troubleshooting
- The replacement shows by the price, not where you expect. The selector matches nothing in that card or page. Check it in the browser's developer tools, inside one product card. See The replacement is in the wrong place.
- A template copy stopped working after an update. Compare your copy with the module's current template and carry the changes over.
- A change has no effect. Refresh the outdated cache types and reload the page.
- On Hyvä the form looks unstyled. The theme CSS was not rebuilt after the companion was installed. See The form looks unstyled on Hyvä.
What's next
- Settings: Developer: every Developer setting with its scope and default.
- Hyvä theme settings: match the price request form to your Hyvä theme.
- The replacement is in the wrong place: checks for a misplaced replacement.
- Compatibility: tested themes and versions.