Skip to content

Tag Syntax

Adrian Edwards edited this page Mar 27, 2019 · 1 revision

The general syntax of the tag is {% EWPform [button type] [separate button] [button image or form ID] %}.

Here's what each of these means:

Parameter Purpose
[button type] determines which type of button to display (see below)
[separate button] determines whether to include the HTML <input...> markup for the paypal button within the form or not (this makes it easier to style with CSS or use other icons). Most people will probably have this set to false
[button image or form ID] If you chose to separate the button fromthe form, then this value will be the ID that you can use to link a <button> or <input> to your form using the form="[id]" HTML attribute.

If you chose not to separate buttons, then this value will be used as the URL for the image of the button. (Sample button code with images can be found here

NOTE: When using the EWPform tag, you do not need to wrap your values in quotation marks. Also, none of the values can contain spaces.

Examples:

BAD: {% EWPform "addtocart" "false" "https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" %}

BAD: {% EWPform add to cart false https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif %}

BAD: {% EWPform addtocart false ./paypal\ buy\ button.jpg %}

GOOD: {% EWPform addtocart false ./paypal-buy-button.jpg %}

GOOD: {% EWPform addtocart false https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif %}




Separated Buttons

When the [separate button] parameter is true, you will need to add code to submit the form yourself.

You can use any HTML tag for this as long as it supports the form="" attribute. This attribute must be used to link to the generated paypal form by setting its value to the same value that you gave to to the form.

For example, if you wanted to use a fontawesome icon for a shopping cart instead of paypal's button:

<button form="paypalviewcart">
    <i class="fas fa-shopping-cart"></i>
</button>

{% EWPform viewcart true paypalviewcart %}

This method also allows you to have more control over the look of your button by allowing you to more easily style your button with CSS

Clone this wiki locally