Prefilled Product Addons

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 0 reply threads
  • Author
    Posts
    • #119014
      david_kogan
      Participant

      I created a custom product type if this product type is chosen by the vendor I would like to prefill the product addons settings.

      I managed it already for the WordPress frontend, but I can’t manipulate the wcfm product to have the required meta_data.

      Here is my code:

      if ( 'auto-draft' === get_post_status( $post_ID ) && get_post_type( $post_ID ) == 'product' ) {
              if ( wc_get_product( $post_ID ) ) {
                  //@formatter:off
                  $data = unserialize('a:1:{....}');
                  add_post_meta( $post_ID, '_product_addons', $data, false );
                  add_post_meta( $post_ID, '_product_addons_exclude_global', '1');
                  //@formatter:on
              }
          }

      The post when creating a a product via the wcfm is not the actual product is a page so it won’t work.

      Is there a way to prefill the post_meta with content for the product template?

Viewing 0 reply threads
  • You must be logged in to reply to this topic.