Skip to content

Add Example with Custom Label for Addon Prices#119

Open
douglaslise wants to merge 1 commit intorecurly:mainfrom
douglaslise:add-tiers-pricing-example
Open

Add Example with Custom Label for Addon Prices#119
douglaslise wants to merge 1 commit intorecurly:mainfrom
douglaslise:add-tiers-pricing-example

Conversation

@douglaslise
Copy link
Copy Markdown
Contributor

Add example using data-recurly="addon_price" for plans with tiered add-ons:

buffer = $.map(plan.plan.addons, function(addon) {
  // usage add-ons need to be displayed separately
  if (addon.add_on_type === 'usage') return;

  const label = `<label for="addon-${addon.code}">
                  ${addon.name}
                  (<span data-recurly="currency_symbol"></span>
                  <span
                    data-recurly="addon_price"
                    data-recurly-subscription="${plan.subscription.id}"
                    data-recurly-addon="${addon.code}"
                  />)
                </label>`;
  const input = `<input type="text"
                  data-recurly="addon"
                  data-recurly-addon="${addon.code}"
                  data-recurly-subscription="${plan.subscription.id}"
                  id="addon-${addon.code}"
                  value="0"
                >`;

  return label + input;
}).join('');

This relies on this Recurly.js PR:

@douglaslise douglaslise marked this pull request as ready for review February 22, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants