HubSpot Code Block | HubDev

Apply GST Tax Per Line Item in HubSpot Quotes Using HubL

Written by HubDev | Jun 24, 2025 8:11:12 PM
In HubSpot Quotes, accurate tax handling at the line item level is essential—especially when GST needs to be applied selectively. A common use case is applying GST only when a custom dropdown field is marked as "Yes".

With HubL, HubSpot’s templating language, this can be handled directly within the quote template. No external scripts, no workarounds—just smart logic embedded in your layout.

Objective

Show the total price including tax (GST) for each line item only when a custom property like apply_gst equals "Yes".

Implementation

Inside the property_name_amount_span_1 span of your quote template, use the following logic:

{ % set price = property_value|float % }
{ % set tax = line_item.hs_tax_amount|default(0)|float % }
{ % set apply_gst = line_item.properties.apply_gst % }
{ % set total = apply_gst == "Yes" ? price + tax : price % }
{ { total|format_currency_value(locale=locale, currency=currency, maxDecimalDigits=max_decimal_digits)|sanitize_html } }

This snippet does the following:

  • Reads the base price from the line item

  • Adds the tax amount only if the apply_gst property is set to "Yes"

  • Outputs the final value formatted with currency rules

Example Use Case

Suppose your quote includes:

  • Custom Website Build (apply_gst: Yes)

  • #BBD0E0 » 5 the editor