2

It took me a while, but I figured out how to get CiviDiscount to work when providing the link directly to the contribution page, however I'm trying to use a shortcode to embed the CiviCRM contribution page into a WordPress page.

The generated shortcode looks like this:

[civicrm component="contribution" id="2" mode="live" hijack="0"]

I modified it to look like this:

[civicrm component="contribution" id="2" mode="live" discount="pkpwpabs7" hijack="0"]

I took a guess, but my guess was wrong. Is there a way to do this?

2

CiviCRM only picks out a discrete list of shortcode parameters: see the code here. Adding an additional shortcode parameter will not make CiviCRM recognize it and add it to the rewritten request.

Unfortunately, without rewriting CiviCRM's WordPress integration, you won't be able to get this to work via shortcode. You'll have to use the big long URL instead. If you're trying to generate a friendly URL, you might have to manually set a rewrite.

| improve this answer | |
  • Looking at the code, it doesn't look like CiviCRM has any hooks to accept custom parameters for extensions either. I'll have to dig a little deeper into how it parses the URL. – Paul Dufresne May 9 '16 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.