Advanced Dynamic Pricing For WooCommerce

Change the Quantity column text of the bulk table

The Advanced Dynamic Pricing for WooCommerce plugin generates a bulk pricing table that displays discount tiers based on quantity. By default, the column headings in this table are set to generic labels such as “Quantity”. However, you may want to customise this text to better suit your store’s language, branding, or customer communication style. For example, you might change “Quantity” to “Units”, “Qty”, “Pieces”, or a translated term. This guide provides a simple PHP code snippet to change the quantity column heading in the bulk pricing table.


The Complete Code Snippet

Copy and paste the following PHP code into your site to modify the quantity column heading:

Replace 'Your Custom Text' with the text you want to display, for example 'Units''Qty', or 'Pieces'. The __() function ensures the text is translation-ready if you manage translations via WordPress’s internationalisation features.

What the code does:

Line / ElementExplanation
add_filter( 'adp_verbose_discount_product_table_cell_qty', ... )Attaches a custom function to the plugin’s filter that controls the quantity column heading in the bulk table.
function( $value, $range, $product, $priceProcessor )The callback receives the default heading, the quantity range object, the product object, and the price processor utility.
$value = __( 'Your Custom Text', 'your-text-domain' );Overwrites the default heading with your custom text. The __() function makes the text translatable.
return $value;Returns the modified heading, which the plugin then displays in the bulk table.

Step‑by‑Step Implementation

Follow these steps to add the custom code to your WordPress site.

Step 1: Choose where to add the code

You have two safe options:

  • Option A (Recommended): Use the free Code Snippets plugin. This is the safest method. Install it from Plugins → Add New by searching for “Code Snippets”. It allows you to add, activate, and deactivate code snippets without ever editing your theme files.
  • Option B: Add to your child theme’s functions.php file. If you are comfortable editing theme files, add the code to your active child theme’s functions.php file. Never add custom code directly to a parent theme, because it will be lost when the theme is updated.

Step 2: Insert the snippet

  • If using Code Snippets:
  • If editing functions.php:

Step 3: Test the functionality

  1. Go to the front end of your site and view a product that has an active bulk pricing rule (e.g., a discount based on quantity).
  2. Locate the bulk pricing table displayed on the product page.
  3. Check the first column heading. It should now display your custom text instead of the default “Quantity”.

If the heading has changed, the implementation is successful.


Customisation Options

The code snippet can be easily adapted for various display requirements.

Change the Heading for Specific Products Only

If you want to change the quantity heading only for certain products, use the $product parameter. For example:

Change the Heading Based on Quantity Range

You might want to display different headings for different discount tiers. Use the $range parameter to access the minimum and maximum quantity of the tier:

Translate the Heading into Another Language

The code already uses the __() function, which marks the string as translatable. To manage translations:

  1. Use a translation plugin like Loco Translate or WPML.
  2. Scan the theme or plugin for translatable strings.
  3. Add a translation for your custom text.

If you do not need translation support, you can simply set $value = 'Your Custom Text'; without the __() wrapper.

Add an Icon or HTML to the Heading

You can include HTML tags in the heading text, for example:

The HTML will be rendered as part of the table header.

Have questions? Please submit a support request. We're always happy to help!

Advanced Dynamic Pricing
for WooCommerce
PRO

From $60
Buy
✓ 30-day money-back guarantee