Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Hardcoding "add to cart" button into theme?

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

  • This topic has 3 replies, 4 voices, and was last updated 12 years, 6 months ago by admin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • December 3, 2010 at 6:10 am #2313
    chelle
    Member

    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!

    December 3, 2010 at 12:57 pm #27008
    wzp
    Moderator

    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.

    October 17, 2012 at 5:20 pm #27009
    robdob
    Spectator

    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.

    October 18, 2012 at 3:03 am #27010
    admin
    Keymaster

    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

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ