Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to add a discount to a paypal buy now button on my wordpress site. I have loaded javascript to calculate the discount, entered code into my header.php to instruct to load the javascript and put the button on my site. Everything seems ok until you are transferred to the paypal site where the price is still the original, no discount taken off. This is the code I'm using for the button.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = 'paypal'; return ReadForm (this);">
    <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="BL9L7384594ZL" />
    <input type="hidden" name="lc" value="AU" />
    <input type="hidden" name="item_name" value="One Day Photography Tour and Workshop" />
    <input type="hidden" name="amount" value="179.00" />
    <input type="hidden" name="currency_code" value="AUD" />
    <input type="hidden" name="button_subtype" value="services" />
    <input type="hidden" name="baseamt" value="179.00" />
    <input type="hidden" name="basedes" value="One Day Photography Tour and Workshop" />
    <input type="hidden" name="no_note" value="0" />
    <input type="hidden" name="cn" value="Add special instructions to the seller" />
    <input type="hidden" name="no_shipping" value="2" />
    <input type="hidden" name="rm" value="1" />
    <input type="hidden" name="return" value="http://goldcoastphototours.com/payment-thank-you/" />
    <input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHosted" />
    <table>
        <tr><td><input type="hidden" name="on0" value="ENTER CLUB NAME">ENTER CLUB NAME</td></tr>
        <tr><td><input type="text" name="os0" maxlength="200"></td></tr>
    Enter Coupon code
    <input type="text" size="10"  name="coupcode" />
    <input type="button" value="Check code" onclick="coupval =this.form.coupcode.value;ChkCoup();" /><br /><br />
    </table>
    <input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" onclick="CalculateOrder(this.form)" alt="PayPal — The safer, easier way to pay online." />
    <img alt="" border="0" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1" />
</form>

I'm quite new at coding so any help would be much appreiated.

share|improve this question
This is not a WordPress question. You're trying to get JavaScript to manipulate a form before it's submitted to PayPal. – EAMann May 4 '12 at 18:24

closed as off topic by EAMann May 4 '12 at 18:24

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

You need to add another hidden input:

... name="coupcode" value"10" ...

Where 10 is the $10 coupon.

share|improve this answer
I need the discount to come from the javascrept as it only applies with a discount code entered. – Rhonda Jan 10 '12 at 9:40

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