This tutorial will walk you through setting up margin-based tax calculation using the COGS Tax plugin for WooCommerce.
STEP 1 : Enable the COGS Tax Plugin
- Go to WooCommerce > Settings > COGS Tax
- Check the box next to “Enable Margin-Based Tax”
- Click “Save changes”

STEP 2 : Set Up Standard Tax Rates
- Go to WooCommerce > Settings > Tax
- Click on the “Standard rates” tab
- Click “Insert row”
- Fill in the tax rate details:
- Country code: Enter country code (e.g., US)
- State code: Enter state code (e.g., CA) or leave blank for all states
- Postcode/ZIP: Enter specific ZIP codes or leave blank for all
- City: Enter specific cities or leave blank for all
- Rate %: Enter the tax percentage (e.g., 8.5)
- Tax name: Enter a name (e.g., “Sales Tax”)
- Priority: Leave as 1 (unless you have compound taxes)
- Compound: Leave unchecked (unless this tax should be calculated on top of another)
- Shipping: Check if tax applies to shipping
5. Click “Save tax rates”

STEP 3 : Create a Custom Tax Class for Margin-Based Tax
- Go to WooCommerce > Settings > Tax
- Scroll down to “Additional tax classes” section
- In the “Add tax class” field, type a name (e.g., “cogs-tax”)
- Click “Add tax class”
- The new tax class will appear in the list

STEP 4 : Set Up Tax Rate for Your Custom Tax Class
A. Add a Tax Rate for Your Custom Tax Class (Margin-Based Tax)
- Go to WooCommerce > Settings > Tax
- Click on the tab for your custom tax class (e.g., “Tax on Profit”)
- Click “Insert row”
- Fill in the tax rate details:
- Country code: Enter country code (e.g., US)
- State code: Enter state code or leave blank
- Postcode/ZIP: Enter specific ZIP codes or leave blank
- City: Enter specific cities or leave blank
- Rate %: Enter the tax percentage for profit margin (e.g., 5)
- Tax name: Enter a name (e.g., “5% Tax on Profit”)
- Priority: Leave as 1
- Compound: Leave unchecked
- Shipping: Check if tax applies to shipping
5. Click “Save tax rates”

STEP 5 : Add COGS Value to Products
- Go to Products > All Products
- Click on a product to edit it
- In the product editor, find the “Product Data” section
- Look for the COGS (Cost of goods ($)) field
- Enter the cost value (e.g., 50 for a $100 product)
5. Click “Update” to save
STEP 6 : Configure Product Tax Settings
A. Set Product Tax Class
- While editing a product, go to the “General” tab
- Find the “Tax class” dropdown
- Select your custom tax class (e.g., “Tax on Profit”)
- Click “Update” to save
B. Configure Margin-Based Tax Setting for Individual Products
- While editing a product, go to the “General” tab
- Find the “Margin-Based Tax” dropdown
- Choose one of these options:
- “Use global setting” – Uses the setting from Step 1
- “Enable” – Always use margin-based tax for this product
- “Disable” – Never use margin-based tax for this product
4. Click “Update” to save

STEP 7 : Test the Tax Calculation
- Add the product to your cart
- Go to the cart page
- You should see:
- Subtotal: Full product price (e.g., $100)
- Tax: Calculated on margin only (e.g., if margin is $50 and tax rate is 5%, tax = $2.50)
- Total: Subtotal + Tax

Example Calculation:
Product Price: $100
COGS Value: $50
Margin: $100 – $50 = $50
Tax Rate: 5%
Tax Amount: $50 × 5% = $2.50
Total: $100 + $2.50 = $102.50
Without margin-based tax, tax would be calculated on full price:
Tax Amount: $100 × 5% = $5.00
Total: $100 + $5.00 = $105.00
STEP 8 : Bulk Edit Products (Optional)
- Go to Products > All Products
- Select multiple products using checkboxes
- Click “Bulk actions” dropdown
- Select “Edit”
- Click “Apply”
- In the bulk edit panel:
- Find “Margin-Based Tax” dropdown
- Select your desired setting
- Click “Update”
STEP 9 : Quick Edit Products (Optional)
- Go to Products > All Products
- Hover over a product and click “Quick Edit”
- Find the “Margin-Based Tax” dropdown
- Select your desired setting
- Click “Update”
TROUBLESHOOTING
- If tax is not calculating correctly, make sure:
- COGS value is set on the product
- Tax class is assigned to the product
- Margin-Based Tax is enabled (globally or per-product)
- Tax rates are properly configured
- WooCommerce tax settings are enabled
- If you see the full product price being taxed instead of margin:
- Check that Margin-Based Tax is enabled in plugin settings
- Verify the product has a COGS value
- Check the product’s Margin-Based Tax setting
SUPPORT
For additional help, contact: plugins@wpsites.net






Leave a Reply