Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
anyone please? i'm really lost in this step. –  NestedWeb Aug 28 '12 at 4:27

2 Answers 2

up vote 2 down vote accepted

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">
</form>

(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 :))

share|improve this answer
    
Thanks, all products didn't have price, they're to be enquired, so i employed buy now buttons. –  NestedWeb Oct 10 '12 at 8:04

This is great. I was looking for a way to have a simple product page where my client could simply add new products with price and few details without messing with complicated plugin or paypal setting. Thanks for the tip.

However, is there a short pay to incorporate paypal IPN so customer can receive payment confirmation through wordpress such as an additional metabox on the product page that will said: paid, receive or payment ID# (from paypal). Basically, I need to find a way to add a payment management or receipt section based on payment confirmation from paypal.

Any help will be appreciated.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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