Customize Purchase Buttons Behavior
How to change the behavior of your purchase buttons
NOTE: You need some basic understanding of HTML in order to do what is required here. To pass the parameters described below, you can simply hardcode them into the button's href=
or action=
URL, or use an HTML form to pass them as form fields, or use JavaScript or other custom scripting to append them to the URL dynamically.
All Cart and Buy Now button codes provided by E-junkie contain a purchase link URL which looks basically like this:
https://www.e-junkie.com/ecom/gb.php?c=XXXXXX&i=YYYYYY
...where XXXXXX is the Client ID of your E-junkie account, and YYYYYY is the product's item number. Your actual URLs will also have some additional parameters which determine whether the URL works as a Cart or a Buy Now button.
To pass a custom variable for the full order:
Add &custom=value_you_want_to_pass
at the end of your Add to Cart or Buy Now buttons' purchase link URL. This will be passed back to you in the Sale Notification email and transaction log, as well as your Integration URL and/or keygen URL (if configured), and you can choose to display it in your Thank-you Page and/or Thank-you Email as well. This value can be up to 255 characters long, and for best results we'd recommend using only letters, numbers, dots.dashes-and_underscores (or at least avoid Reserved or Unsafe characters in URLs).
Although this custom value is passed to the cart by clicking an Add to Cart button, the custom value itself is only associated with the whole order, rather than any particular item in the order, so there can be only one custom value per order. If more than one button has a Custom value, only the Custom value of the last button clicked will be passed with the order. If you need to pass the same custom value regardless of which Add to Cart button(s) the buyer clicks, make sure you append the custom parameter to the URL of every Add to Cart button the buyer might use that could pass the custom value into the cart.
Pass custom values for each product
You would normally use Variants or Variations for that, but E-junkie only allows up to 6 options values to be passed in our buttons (up to 3 menus for "Variants affecting price/weight/stock/SKU", and/or up to 3 menus or text fields for "Variations which tell more about the product"). Bear in mind information such as buyer name, email, and address (if you enable Require Buyer's Shipping Address for your product) would typically be collected during checkout, so there's usually no need to collect that information separately with your purchase buttons.
If you need more than 6 option fields/menus, with some additional custom scripting at your end, you could have additional menus/fields on your page that would get concatenated (strung together) into the max. 3 Variations fields that can be passed into the cart by dynamically appending them to the button URL, as shown below. This would also work if you need to pass some Variations values to checkout automatically without manual buyer input:
&on0=Options&os0=string_with_all_values
(This string can't be more than 64 characters. If that's not enough, you can add the following.)
&on1=More+Options&os1=another_string_with_more_values
&on2=Even+More+Options&os2=yet_another_string_with_even_more_values
(These strings can't be more than 64 characters each.)
This will work for E-junkie Add to Cart buttons regardless of checkout method, but for Buy Now buttons it will only work with PayPal checkout. Note that every os#
(option selection) value needs to be accompanied by a corresponding on#
(option name) value—e.g., os0
must be accompanied by an on0
), and higher-index pairs will only be passed if lower-index pairs are also passed—i.e., on1
/os1
can only be passed if on0
/os0
are also being passed, and on2
/os2
can only be passed if on0
/os0
and on1
/os1
are also being passed.
Pass product price other than the amount set in E-junkie Admin
- E-junkie Add to Cart buttons:
- Add
&amount=amount_you_want_to_pass
at the end of the purchase link URL in your Add to Cart button. This amount will be added to the price you have set in admin, so buyers will be shown the combined price. - E-junkie Buy Now buttons:
- Add
&amount=amount_you_want_to_pass
at the end of the purchase link URL in your button. This amount will override the price you have set in Seller Admin, as long as it meets or exceeds that price.
Item Quantity
Add &quantity=N
(where N
is your desired quantity) at the end of the purchase link URL in your button code. Passed quantity will be ignored if you have set item price as 0.00 in Admin, as free products are limited to orders of 1 unit at a time. You can also disable the Let buyer edit quantity setting for the product—e.g. if you want buyers to add more than 1 unit to their cart without allowing the buyer to edit it back down to 1 nor adjust the quantity any higher.
This help page explains how to add a Quantity text field or dropdown menu to your E-junkie Cart button codes, so buyers can specify their desired quantity before clicking Add to Cart. The menu approach is particularly useful if you want to have a maximum allowable quantity, as buyers would only be able to pick from the quantity range you provide in the menu.
Discount Codes
This help page explains how to automatically apply a discount code in your E-junkie purchase button or link URL.
Advanced Methods for Developers
Any GET parameter (e.g. &name=value
) that would normally be passed in the query string of an E-junkie Add to Cart button's href=
or action=
URL can also be passed as a POST parameter in an E-junkie Add to Cart form, and vice-versa. This can come in quite handy when programming scripts to perform custom functions that E-junkie does not natively support.
For instance, product option values using Variations, which the buyer normally selects from a menu or enters in a text field, can also be passed in the button URL as &on0=somename&os0=somevalue...etc.
; these parameter values can be completely arbitrary and don't have to match anything in the product's settings, but note the length limitations and pairing requirements in the "Pass custom values per product" section discussed above.
Likewise, option values using Variants can be passed directly in the Add to Cart button URL as &o1=this&o2=that&o3=other
; in this case, note the values you pass must match a combination of values you have defined in your Variants configuration. For a more detailed explanation, please see this tutorial.
Moreover, parameters that are normally passed in the button URL (such as &i=XXXXXX
for the item number) could instead be passed via form fields or menus—e.g., you could show a single Add to Cart button with a menu to pick which item it adds to the cart, as in the example code below, where XXXXXX
represents your E-junkie Client ID, and YYYYYY
and ZZZZZZ
represent the item numbers of products named "Widget" and "Wibble":
<form action="https://www.e-junkie.com/ecom/gb.php?c=cart&ejc=2&cl=XXXXXX" target="ej_ejc" method="POST" accept-charset="UTF-8">
<select name="i">
<option disabled selected>↓ Pick one ↓</option>
<option value="YYYYYY">Widget</option>
<option value="ZZZZZZ">Wibble</option>
</select><br>
<input src="https://www.e-junkie.com/ej/ej_add_to_cart.gif" alt="Add to Cart" class="ec_ejc_thkbx" onclick="return EJEJC_lc(this.parentNode);" type="image" border="0">
</form>