Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Troubleshooting › Problems adding "Add to Cart" on index.php using Custom Fields › Reply To: Problems adding "Add to Cart" on index.php using Custom Fields
@bballa, The PHP code you have cooked up is no good. Please note that this is no way possible for us to teach you PHP programming language here. You should maybe look at the official site for PHP and see if they have any forum for this.
with that said, here is the method signature of the function that you are trying to call:
function get_button_code_for_product($id)
the “get_button_code_for_product” method takes one parameter and that is the ID of the product that you are trying to show the button for. So all you need to do is pull the product ID from the custom field and pass it to this function. You can try something like the following:
<?php
$values = get_post_custom_values('prodid');
echo get_button_code_for_product($values[0]);
?>
Just a note… the above code hasn’t been tested.