- This topic has 1 reply, 2 voices, and was last updated 11 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 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 › eStore – Using a custom post type with metadata and Add to Cart
Tagged: Custom post types, get product by name
Hello,
I would like to use custom posts to store my product info – I have a lot of data to store, including background colour, foreground colour, name, code, and so on, and I need to be able to sort/filter based on these attributes. What I would like to do is put some code in my template file that can automatically add an ‘add to cart’ based on data in my post, without having to create a product.
-or-
alternatively, automatically create a product based on a post.
I’m making a system for downloading images, each post will have a thumbnail and a few different options of images in zip packs for download, eg, png, vector, etc, depending on the variation selected. I would like to be able to use WordPress post functionality to handle all the data for these, and use WP eStore to handle the costing, transaction and download aspect. Does anyone have any advice?
Thank you!
Hi, Adding a purchase button for your product in the template file won’t be hard. Here is an example snippet of code that can retrieve the product ID value of a post from the custom field and then creates an “add to cart” button for that product:
<?php
$product_id = get_post_meta($post->ID, 'product_id', true);
get_button_code_for_product($product_id);
?>
Do you have a system in place for doing all these custom post type stuff though?