Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › eStore – Use existing custom post type meta field for product ID
- This topic has 3 replies, 3 voices, and was last updated 10 years, 2 months ago by
wzp.
-
AuthorPosts
-
March 7, 2015 at 9:28 am #12318
pstavrou
MemberI already have a custom post type, with its own custom fields. I would prefer to use that information instead of re-entering everything in your plugin’s “Manage Products” section.
I use this code:
<?php
$product_id = get_post_meta( get_the_ID(), ‘MY_CUSTOM_FIELD’, true );
echo get_button_code_for_product($product_id);
?>
It returns this error message:
“Looks like you have entered a product ID (MY CUSTOM FIELD VALUE) that doesn’t exist in the product database. Please check your product ID value again!”
Is there a way to use my existing database entries?
March 7, 2015 at 10:51 pm #68995wpCommerce
ModeratorHi, Have you checked to make sure that $product_id variable has a value assigned to it? echo the $product_id value before you call the eStore’s function. If the variable is not empty then is it passing a valid product ID that exists in the eStore database?
March 8, 2015 at 6:57 am #68996pstavrou
MemberThank you for your prompt reply. The eStore database is empty and therefore there is no valid product ID.
I am just asking if it is possible to use existing database entries (my custom post type with its own custom fields), instead of the eStore database. It seems that to use the eStore database it is necessary to manually enter all the content. I would rather avoid that cumbersome procedure, since my data already exists as my own custom post type.
As a side note, I am already able to successfully use php to call my custom fields with the free version of your plugin — I don’t need to retroactively enter the shortcode. It would be great if I could do the same with the premium version.
March 8, 2015 at 1:44 pm #68997wzp
ModeratorSo, from what I understand, you want to not use the eStore database to run your store.
You must have an eStore product configured in the eStore plugin to use it. Here are some similar topics:
- https://support.tipsandtricks-hq.com/forums/topic/estore-help-moving-from-wp-paypal-shopping-cart-to-wp-estore
- https://support.tipsandtricks-hq.com/forums/topic/estore-upgrading-from-simple-paypal-shopping-cart-to-estore-cart
- https://support.tipsandtricks-hq.com/forums/topic/using-shortcde-to-create-products
- https://support.tipsandtricks-hq.com/forums/topic/estore-on-the-fly-product-workaround
-
AuthorPosts
- You must be logged in to reply to this topic.