Back to Blog

How to Conditionally Hide Line Items in a Salesforce Quote PDF

How to Conditionally Hide Line Items in a Salesforce Quote PDF

The native Quote PDF has no logic to hide selected line items, pushing teams into checkbox hacks and rollup fields. Here is why, and how section-level conditional structure solves it cleanly.

ZeroExport Team

You have a quote with a dozen line items, and you want the PDF to show only some of them: hide internal-only products, suppress zero-dollar rows, or omit a bundle's child components. On the standard Salesforce Quote PDF, there is no switch for this. So you start hunting for a workaround, and the workarounds get ugly fast.

Why the native Quote PDF can't hide line items

The standard Quote PDF template is a flat layout with no conditional logic. It renders the quote line items it is given, in order, with no way to say "show this row only when a condition is true." The template has no concept of a rule per line: it just prints the list.

That limitation cascades into related problems teams hit constantly:

  • No way to conditionally hide a table header when its section is empty, so you get an orphaned header above nothing.
  • No way to show a group's rows only when the group has data.
  • No way to vary which columns appear based on product type.

Because the logic doesn't exist in the template, you have to fake it somewhere else.

The workarounds, and why they hurt

The common hacks to hide line items in a native Quote PDF all push complexity into your data model:

  1. A "Selected" checkbox plus blanked fields. Add a checkbox, then zero out or blank the amount fields on unselected lines so they contribute nothing, and hope an empty row is acceptable. You are editing real quote data to change how a document looks.
  2. Rollup summary fields that re-total only the "selected" lines, so the grand total is right even though the hidden lines still technically exist.
  3. Duplicate quotes, one "internal" and one "customer-facing", kept in sync by hand.
  4. A custom Visualforce page that filters the lines in Apex, which means maintaining code and CSS against the PDF engine.

Every one of these makes the document tool a stakeholder in your data: change the document requirement and you are back editing checkboxes, rollups, or Apex.

The clean fix: conditional structure, not data hacks

The right place for "show this only when…" logic is the document, not the quote record. ZeroExport is built around exactly that idea: sections and their contents carry conditions, so the template decides what appears.

For hiding line items specifically, that means:

  • Section-level visibility that cascades. Put a condition on a section ("only lines where Show_On_Quote__c is true," or "only lines with amount greater than zero"), and everything inside it, including its header, appears or disappears together. No orphaned headers, no blanked fields.
  • Adaptive layout on missing data. When a section has no qualifying lines, the layout closes up instead of leaving a gap where the table used to be.
  • One template, multiple outputs. The same template produces the internal version and the customer-facing version based on conditions: no duplicate quotes to reconcile.
  • No changes to your quote data. The line items stay exactly as they are in Salesforce. The document filters them at render time; your amounts, rollups, and records are untouched.

The difference is architectural: instead of distorting the quote to control the PDF, you express the rule once, in the template, where it belongs.

FAQ

Can the standard Salesforce Quote PDF hide specific line items?

No. The native Quote PDF template has no conditional logic: it renders every line item it is given. Hiding lines requires either editing the underlying data (checkboxes, blanked amounts, rollups) or building a custom Visualforce page.

How do I hide a line item table header when there are no rows?

On the native template you can't, which is why empty headers are a common complaint. With section-level conditional visibility, the header lives inside the section and disappears with it when there are no qualifying rows.

How does ZeroExport hide line items without changing my quote data?

You put a condition on the section that renders the lines: for example, only lines flagged to show, or only lines above a certain amount. The condition filters what the document renders; the quote line records in Salesforce are never modified.

Can one template produce both an internal and a customer-facing quote?

Yes. Because visibility is driven by conditions rather than duplicate templates, the same template can render different versions depending on the data or context, so you don't maintain two quotes.

Related Reading

Ready to try ZeroExport?

Start generating documents directly in your Salesforce org. No integrations, no setup overhead, no complexity.