Why do shipping address merge variables show blank lines in email notifications?
Problem Statement
You added subscription shipping address merge variables (such as {{subscription_shipping_address.line1}}, {{subscription_shipping_address.line2}}, and {{subscription_shipping_address.city}}) to an email notification template. Empty address lines leave extra blank rows in the sent email, or every shipping field appears blank even though you expect values for city, state, or zip.
Related Scenarios
- A comma or other punctuation appears before city or state when an earlier address line is empty.
- You collect a shipping address outside Chargebee and merge variables stay empty in live emails.
Solution
Blank rows usually mean line breaks in the template sit outside conditional blocks, so they still print when a merge field is empty. An entirely empty shipping block usually means Chargebee has no shipping address stored on the subscription for that email event.
Use one of the approaches below.
Option 1 — Address Details section (recommended)
- Go to Settings > Configure Chargebee > Email Notifications.
- Open the notification you want to edit and click Edit.
- Click Add Section and choose Address Details.
- Select Shipping address (or billing and shipping, if you need both).
- Click Publish.
Chargebee formats the address and omits fields that have no value. Layout follows the standard address section rather than a fully custom design.
Option 2 — Custom merge variables with conditional blocks
- Go to Settings > Configure Chargebee > Email Notifications.
- Open the notification, click Edit, and place the cursor in the body (or switch to HTML mode if you use custom HTML).
- Replace one-field-per-line layouts with conditionals so line breaks sit inside each
{{#field}}…{{/field}}block for optional lines.
Example for address lines and city or state on one row:
{{subscription_shipping_address.line1}}{{#subscription_shipping_address.line2}}
{{subscription_shipping_address.line2}}{{/subscription_shipping_address.line2}}{{#subscription_shipping_address.line3}}
{{subscription_shipping_address.line3}}{{/subscription_shipping_address.line3}}
{{subscription_shipping_address.city}}{{#subscription_shipping_address.state}}, {{subscription_shipping_address.state}}{{/subscription_shipping_address.state}}{{#subscription_shipping_address.zip}} {{subscription_shipping_address.zip}}{{/subscription_shipping_address.zip}}- Click Publish and send a test email from the template.
See Mail Merge Usage for how conditional blocks work.
Verify shipping address data on the subscription
If city, state, zip, and all lines are blank in the sent email:
- Open the subscription in Chargebee and confirm a Shipping address is present on the record.
- If the address is missing, collect or sync it into Chargebee (checkout fields, API, or a manual update). See Shipping address and labels.
- Re-send or preview the email after the subscription shows the shipping address.
Merge variables only reflect data stored in Chargebee; they cannot show values that were never written to the subscription.
Important Notes
- Storing a shipping address on a subscription is separate from the customer's billing address. Collecting shipping address for fulfillment does not by itself copy that address into billing address fields. Payment authorization uses the billing address and payment method details associated with the transaction, not the shipping address merge fields in an email template.
- You can enable shipping address collection without requiring billing address on checkout when your site is configured for it. See Shipping address and labels.