Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Example with Custom Label for Addon Prices #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

douglaslise
Copy link
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