The pmpro_tax filter hook allows you to add custom tax amounts to orders with PMPro. In this guide, I’ll cover one of the most common methods of handling taxes that we see for our customers. The method includes checks for the user to choose a region as well as region validation on their billing address.

Note that if you’re currently using Stripe Checkout, you won’t need this code recipe. Stripe Checkout seamlessly integrates with Stripe Tax to calculate sales tax, VAT, and GST during the payment step. This makes the process of filing and remitting taxes much simpler for business owners.

Banner Image Non-US Taxes with Paid Memberships Pro

Overview of Custom Tax Functionality

  1. Add a checkbox at checkout for users to self identify themselves from a certain region.
  2. Add an extra check at checkout to apply tax if the billing address is from a certain country and/or region.
  3. If the checkbox or the address check matches, apply a certain tax rate at checkout.
  4. Update the level cost text to communicate the appropriate tax information.

Here is a plugin that does just that. Just replace the country and region names, tax amount, and other checks in the code below and this should work for most cases where you need to charge tax for customers from a single region only.

The Code Recipe

This code recipe requires a premium membership plan.

View Pricing

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

Was this article helpful?