---
title: Developer Hooks, Filters and Functions Reference
description: "Developer reference for MSRP (RRP) Pricing for WooCommerce: value, behavior, section and bulk converter filters."
url: "https://wpfactory.com/docs/msrp-developer-hooks-filters-reference/"
updated: "2026-09-27"
category: Developers
---

# Developer Hooks, Filters and Functions Reference

The developer hooks and filters in [MSRP (RRP) Pricing for WooCommerce](https://wpfactory.com/item/msrp-for-woocommerce/) let you adjust MSRP values, templates and display behavior in code without editing plugin files. Every filter below fires inside the plugin's own calculation and rendering paths, so a callback you register replaces the value the plugin would otherwise use.

All settings referenced here live under **WPFactory > MSRP** (also reachable at **WooCommerce > Settings > MSRP**). The plugin stores a product's MSRP in the `_alg_msrp` post meta key, with `_alg_msrp_by_country` and `_alg_msrp_by_currency` holding the per-country and per-currency values.

### Value and behavior filters

These are the filters most developers reach for. They fire on the value the plugin is about to use, so whatever you return wins.

| Filter | Filtered value | Arguments |
| --- | --- | --- |
| `alg_wc_msrp` | A product's raw MSRP value read from the `_alg_msrp` meta. | `$msrp, $product_id` |
| `alg_wc_get_msrp` | The resolved MSRP array, in the form `array( 'msrp' => ..., 'currency' => ... )`. | `$data, $product_id` |
| `alg_wc_msrp_template` | The display template used for a section (single, archives or cart). | `$template, $section_id` |
| `alg_wc_msrp_template_msrp_no_defined` | The template used when a product has no MSRP defined. | `$template, $section_id` |
| `alg_wc_msrp_check_user_role` | Whether the current user is allowed to see MSRP (returns a boolean). | `$can_see, $core` |
| `alg_wc_msrp_variable_hash` | The cache key hash used by the variable MSRP optimization (transients or array). | `$hash` |

### Section-gating filters

These filters decide whether a Pro section is active. In the free version they return `no`. In Pro they return the value of the matching enable option, so hooking them lets you force a section on or off in code.

| Filter | Controls | Expected return |
| --- | --- | --- |
| `alg_wc_msrp_by_country` | Whether the MSRP by country section is active. | `yes` or `no` |
| `alg_wc_msrp_by_currency` | Whether the MSRP by currency section is active. | `yes` or `no` |
| `alg_wc_msrp_cart_total_savings` | Whether the cart total savings section is active. | `yes` or `no` |

### Bulk MSRP Price Converter filters

The Bulk MSRP Price Converter tool exposes its own filters, so you can extend rounding and product selection.

| Filter | Filtered value | Arguments |
| --- | --- | --- |
| `alg_wc_msrp_bpc_round_price` | The rounded price for a product during a bulk conversion. | `$price, $round_function, $round_coef` |
| `alg_wc_msrp_bpc_pretty_price` | The "pretty price" adjustment applied above the threshold. | `$price, $threshold` |
| `alg_wc_msrp_bpc_product_query` | The `WP_Query` args used to select products by category or tag. | `$args, $taxonomy, $terms` |
| `alg_wc_msrp_bpc_settings` | Internal gate that unlocks the tool's Pro-only fields. Returns an empty string in Pro. | `$value, $type, $args` |

The related filter `alg_wc_msrp_settings` is used the same way for the main settings screen: it returns an empty string in Pro to remove the "disabled" attribute and upgrade notice from Pro-only options. Treat both as internal gates rather than extension points.

### The MSRP shortcode

The plugin registers one shortcode, `[alg_wc_msrp_wpml]`. It shows its inner content only for (or only outside of) the given languages, which is handy inside the template fields when you run WPML or Polylang.

```
[alg_wc_msrp_wpml lang="en"]MSRP[/alg_wc_msrp_wpml]
[alg_wc_msrp_wpml not_lang="de,fr"]MSRP[/alg_wc_msrp_wpml]
```

| Attribute | Meaning | Default |
| --- | --- | --- |
| `lang` | Show the content only when the active language is in this comma-separated list. | empty |
| `not_lang` | Hide the content when the active language is in this comma-separated list. | empty |

### The MSRP helper function

Use `alg_wc_msrp_get_product_msrp()` in theme templates or snippets to read a product's MSRP or its computed discount.

```
<?php
// Raw MSRP of the current product.
$msrp = alg_wc_msrp_get_product_msrp();

// MSRP of a specific product.
$msrp = alg_wc_msrp_get_product_msrp( 123 );

// Savings amount (MSRP minus current price).
$saved = alg_wc_msrp_get_product_msrp( 123, 'msrp_discount' );

// Savings percentage, rounded to 1 decimal.
$percent = alg_wc_msrp_get_product_msrp( 123, 'msrp_discount_percent', 1 );
?>
```

| Parameter | Purpose | Default |
| --- | --- | --- |
| `$product_id` | Product to read. `0` uses the current global product. | `0` |
| `$msrp_option` | One of `msrp`, `msrp_discount`, or `msrp_discount_percent`. | `msrp` |
| `$discount_percent_round_precision` | Decimal places for the percentage result. | `0` |

The function returns `0` when the product has no MSRP. It currently resolves the MSRP for simple products; for variable products, read the variation ids directly.

**Note:** the value filters such as `alg_wc_msrp` and `alg_wc_get_msrp` run for both simple and variable products, so a callback you attach applies consistently across your catalog.

### Related placeholders

For the template placeholders you can use inside the display and savings fields (`%msrp%`, `%you_save%`, `%you_save_percent%`, `%price%`, `%total_savings%`, `%from%` and `%to%`), see the [MSRP template placeholders reference](https://wpfactory.com/docs/msrp-for-woocommerce/).

Need a hand? Our team answers every ticket on the [MSRP Pricing support forum](https://wpfactory.com/support/item/msrp-for-woocommerce/).

Related articles

- [MSRP Template Placeholders Reference](https://wpfactory.com/docs/msrp-template-placeholders-reference/)
