I've setup a post type-Product with custom fields containing price and other attributes.

I'm reading Paypal Documentation right now,
What i've read till now is "HTML-Buttons" can be pasted from Paypal, but i can't tell my client to copy and paste the "Add to Cart" button from Paypal every time he creates a new product.

Even the plugins tagged with "Paypal" seem manual. I wanted something that would take price and other attributes programmatically from custom fields.
I don't want my client to do any thing regarding Paypal.

So my question:

Should i ditch my almost-complete theme and build everything from ground up with Woocommerce? Or is there still a way to integrate Paypal into this theme.

Thankyou for your time and thoughts.

  • anyone please? i'm really lost in this step.
    – NestedWeb
    Aug 28, 2012 at 4:27

1 Answer 1


You can create a custom template in the theme that displays the 'products' custom post types (see the section on Template Files in Custom Post Types).

Then code the HTML for the Paypal button in to your specific single-{posttype}.php and have the attributes such as price, etc, coming from custom fields.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="example@example.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="<?php $meta_values = get_post_meta($post_id, 'product-name'); ?>">
<input type="hidden" name="item_number" value="<?php $meta_values = get_post_meta($post_id, 'product-reference'); ?>">
<input type="hidden" name="amount" value="<?php $meta_values = get_post_meta($post_id, 'product-value'); ?>">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">

(I think that is correct but it's been a while since I've played with custom fields so apologies if it needs further tweaking)

P.S - Although, are you sure you want to use Paypal's own cart? It would be more graceful to use a shopping cart plugin for Wordpress (which you can use with your own theme) then have the total value go through to Paypal when the customer is ready to pay (probably an obvious thing to say but just thought I'd mention it in case :))

  • Thanks, all products didn't have price, they're to be enquired, so i employed buy now buttons.
    – NestedWeb
    Oct 10, 2012 at 8:04

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.