- This topic has 3 replies, 4 voices, and was last updated 12 years, 1 month ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Hardcoding "add to cart" button into theme?
Tagged: add to cart in template
Just bought estore and so far it is just what I needed.
My only question so far is I would like to hard code the add to cart button into my product page for my theme template, but not sure the way to do this. I read the function reference ebook and see I can use this template tag:
<?php echo get_button_code_for_product(1); ?>
But if I understand this all correctly, I need to somehow identify what the product ID is – “1” refers to the product ID, correct? Is there a way to do this with custom fields within the post? So I could just create a custom field for “postID” and the add to cart button would know what it would be?
I appreciate any suggestions or help with figuring out a way to do this
Thanks!
WARNING — Running With Scissors (Highly technical discussion)
You are correct, the “1” is the product ID number. If you are writing a PHP script, and you have a variable (returned from a form POST)called $pro_id then you would substitute the “1” with the $pro_id variable name.
Try creating a private “test page” to try your script out. On my site, I have one that contains one of every button.
Hi Chelle, were you able to fix this? I want to be able to do this too.
Wzp – is there a script you could provide?
Thanks.
Yeah, you can easily get the Product ID values from the custom field of that post. The following post should help:
https://support.tipsandtricks-hq.com/forums/topic/custom-fields-within-php-shortcodes