Skip to content

Instantly share code, notes, and snippets.

@dparker1005
dparker1005 / pmpro_flat_tax_rate.php
Last active September 30, 2019 10:05
Based off of https://www.paidmembershipspro.com/custom-tax-structure-using-the-pmpro_tax-hook/ to add a flat tax rate to all purchases. Make sure to change tax rate before use.
<?php
/*
Custom Tax Example.
- Requires PMPro 1.3.13 or higher.
- Leave the tax fields blank in the payment settings.
- We update the price description to include the tax amount.
*/
function my_pmpro_tax($tax, $values, $order)
{
$tax = round((float)$values[price] * 0.055, 2);