As you know, Dynamic Pricing does not print a discount table in the single product page. This is due to the complexity of the discount rules you can create which makes impossible for the plugin to create a discount table.

But you can still do it manually. You will learn how to do this here using two free plugins with Dynamic Pricing.

Requirements

How to create the discount table

Be sure to have all the three plugins installed ad active.

The first thing you need to do is to create a discount rule for some products. In this example I’ll do it only on one product. I configured it like this:

Dynamic pricing rules

Then you need the content block to print in the product tab.

Go to Settings > Global Content Blocks and create a new content block like this one:

Global content block

After creating it, be sure to copy the shortcode of the content block from Settings > Global Content Blocks:

Global content block shortcode

and go to your product admin page in Products > All Products > Edit a product.

With WooCommerce Custom Product Tabs Lite you will now have a new tab in the section Product Data named Custom Tab. This tab will allow you to create a new product tab specifying a title and the content.

In this example I used Discounts for the title, and the Global Content Blocks shortcode for the content:

Custom tab content

Going to the product single page you will see a new tab named Discounts with the table of discounts. It should look like this (using Storefront):

Discount table on Storefront

WordPress does not have the table buttons in the editor, you will need to create the HTML code for the table manually. Here is the HTML used for this tutorial:

11 replies
  1. David Chesnick
    David Chesnick says:

    Hi Nicola. Thanks for this very useful post. It’ll be perfect for an commerce site I’m building that supports both Wholesale and Retail customers. I have a question though… suppose I want show or hide these elements based on user type? How can I hide them from retail customers and make them visible to wholesale customers?

    Reply
  2. John
    John says:

    So this discount table is hard-coded, which is NOT sync with the real pricing, right? How can I do it to make it change automatically on the front-end after I change the real pricing in the back-end?

    Reply
  3. Rochelle
    Rochelle says:

    Hi, the plugin Global Content Blocks is no longer available, do you have another suggestion for implementing this?

    Reply
  4. Marianne
    Marianne says:

    Hello Nicola,
    Great way to show a price table on the product page.
    Is there a piece of code to show the product name in the table. I mean, I have variable products and the price tables show, but there is no way to figure out for the customer which product the price table is for.
    Kind regards,

    Reply

Trackbacks & Pingbacks

  1. […] Since there are many ways in which an advanced rule can be triggered and these are dependent on the quantity of products in the cart, there is no practical way to calculate what and what not might apply to a particular customer when using advanced rules until the item has been added to the cart. The most common approach to this, and the way that is used on most big box retailers, is to advertise the sale in the sidebar, banner or somewhere else on the site. The alternate approach is to use actions from WooCommerce to add a description to individual products or entire categories of products. See this quick example for an idea of where to get started: Creating a Dynamic Pricing Discount table in the product page. […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

You have to agree to the comment policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.