1

I have recently created a php script to import new products into Woocommerce. Please see how it was done here How to add product in woocommerce with php code.

The question I have is related to the product type. When you add a new product in the backend you can choose the product type: simple, grouped, external/affiliate, and variable product.

When I create new products with the script it uses the simple product type by default and I cannot find anywhere in the woocommerce database where I can change the product type to external/affiliate. Does anyone know where that data is stored for each product?

I check and double checked the posts and postmeta tables and cannot find anything related to the product type. I attempted a search in the options table but cannot find anything either unless it's encoded in there.

I appreciate any help :)

closed as off-topic by anu, Pieter Goosen, Johannes Pille, gmazzap, cybmeta Nov 21 '14 at 12:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • I can't really see why this could be off topic because woocommerce is built for WordPress and the issue I had was related to the way WordPress stores its data. It is resolved now, thank you :). – Kobus Beets Nov 24 '14 at 11:46
0

Products are Custom Post Types, so you can find it in wp_posts.post_type='product' || 'product_variation', etc.

enter image description here

  • Thank you for your comment. I am more specifically looking for data that uniquely identifies the product as an external/affiliate product. There are 4 types of products: simple, grouped, external/affiliate, and variable. – Kobus Beets Nov 20 '14 at 9:59
  • In this case, the info of each product line is in wp_woocommerce_order_items and order_itemmeta table. – josearcos Nov 21 '14 at 12:38
  • 1
    Just to let you know about the product type in case you come across it someday. The product type is stored as a taxonomy term. The term is "external" and the taxonomy is "product_type". When you link that to a product, that product is used as an external/affiliate product. Thank you for your responses, I appreciate it. :) – Kobus Beets Nov 24 '14 at 11:49
  • @josearcos that is wrong. That is the product type of orders, not of the actual products stored in the database. The last comment by Kobus Beets should be the accepted answer. – kontur Sep 1 '17 at 6:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.