Dynadot โ€” .com Registration $8.99

WordPress Help

Spaceship Spaceship
Watch

Whogister

Established Member
Impact
118
I'm using the Simple Paypal Shopping Cart Plugin for one of my websites.

The plugin itself works and I like it...

Format for the Add To Cart button (place in page template of theme)
PHP:
<?php echo print_wp_cart_button_for_product('Product Name',Price); ?>

When I manually enter a product name and price like below it works
PHP:
<?php echo print_wp_cart_button_for_product('Widget',9.56); ?>
(product is added to the cart and displayed correctly)

But when I try to populate it with the actual product name and price it will not work
PHP:
<?php echo print_wp_cart_button_for_product('the_title()',$price); ?>
(product is added to the cart but the name is "the_title()" and the price show as "$0.00")

For the product price I am trying to pull it out of the custom field that I use when adding the product page:
PHP:
$price=get_post_meta($post->ID, 'Price', true);

The title and price show everywhere on the page except for the plugin function... can anyone tell me why?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
It's simple
Code:
<?php 
$title = get_the_title();
echo print_wp_cart_button_for_product($title,$price); ?>
 
2
•••
Wow, that was simple... thank you very much :)

It's simple
Code:
<?php 
$title = get_the_title();
echo print_wp_cart_button_for_product($title,$price); ?>
 
1
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back