Title: Populating HTML Code With Custom Field Variables
Last modified: August 21, 2016

---

# Populating HTML Code With Custom Field Variables

 *  Resolved [chetbrz](https://wordpress.org/support/users/chetbrz/)
 * (@chetbrz)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/populating-html-code-with-custom-field-variables/)
 * I am trying to use the HTML code in my page template and populating the product
   name from the page title and the price from the custom field variable as such:
 * `<?php $price=get_post_meta($post->ID, 'Price', true); ?>`
    `<?php echo print_wp_cart_button_for_product('
   the_title()',$price); ?>`
 * The above does not work. When added to the cart the product name shows as “the_title()”
   and the price shows as “$0.00”
 * The title and price variables work when I put them anywhere else on the page 
   template… but just not in the cart code.
 * [http://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/](http://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/populating-html-code-with-custom-field-variables/#post-4131758)
 * Hello chetbrz this [link ](http://www.tipsandtricks-hq.com/ecommerce/simple-wp-shopping-cart-installation-usage-290)
   should help you understand the code better.
 * Kind regards
 *  Thread Starter [chetbrz](https://wordpress.org/support/users/chetbrz/)
 * (@chetbrz)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/populating-html-code-with-custom-field-variables/#post-4131759)
 * Yes, I seen that and understand how the code works…
 * But the plugin is not reading the $price or title variables that the rest of 
   the template does.
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/populating-html-code-with-custom-field-variables/#post-4131762)
 * You would have to check the way the plugin has been developed to call the variables
   that you are referring too.
 * I know what you are trying to achieve but I think it is not possible with the
   current version of this plugin unless you hack the code yourself.
 * Kind regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Populating HTML Code With Custom Field Variables’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-simple-paypal-shopping-cart/assets/icon-128x128.
   png?rev=2722490)
 * [Simple Shopping Cart](https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/populating-html-code-with-custom-field-variables/#post-4131762)
 * Status: resolved