Support

Account

Home Forums General Issues ACF & Woocommerce query

Solving

ACF & Woocommerce query

  • Hi … needed some advice about adding custom fields to Woocommerce products cpt.

    Basically i have a woocommerce installation and i want to add a few more custom fields for each product. This i have done using ACF in WP admin to create a field group and attach it to the “products” cpt. So if i add a new product or edit existing product, i can see these fields and add data using them for that particular product in the wp backend.

    However, I have developed a front-end form using “gravity forms” which can add new products to the site from the user’s account (front-end) page. This works well using “gravity forms” and the “advanced post creation” plugin. However im not sure how to map the “custom fields” i created with ACF for the product. Does ACF store custom fields in the wp_posts_meta table as key, values for a CPT – products?

    Also a general question: How does ACF store custom field data in the DB for a post, page or custom post type? Tried searching the docs for info on this but couldnt find it or i may have missed it.

    Appreciate some thoughts on this.

    Thanks in advance.

  • Hello @chrislopezz

    Does ACF store custom fields in the wp_posts_meta table as key, values for a CPT – products?
    Yes, ACF stores it in posts_meta table.

    Thanks

  • There isn’t much documentation on how ACF stores values in the DB. Some of us know because we’ve looked. Simple fields that store just text values are saved just like WP custom fields in the DB. More complex fields are not. It really depends on what field types you are using how difficult it will be to get them from GF into ACF. For complex fields you will need to add code that runs when the post is created (see the GF documentation on this) and update the ACF fields.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.