Get Value from PPOM Fields

WooCommerce
12 November, 2021 13:10:18
pollrrm
Topics: 3
Messages: 8
Hi, I am currently using PPOM for Woocommerce add-on https://wordpress.org/plugins/woocommerce-product-addon/ and I am trying to figure out how to display the values from the form fields.

I would only like to display or show from specific product on the order.

I am able to display the PPOM Fields (if there's only 1 product on the order) but if there's more than one, or if the first order is not the specific product with PPOM, they are not showing

Sample Order (1 product):
- Product C (Only product C has PPOM Fields) which I would like to display the field.

With this code, I am able to display the PPOM fields on the PDF
[e2pdf-wc-product key="breed_of_pet_" order_item_meta="true" index="0"]

But if this is the order:
- Product A
- Product C

The PPOM field is not showing
13 November, 2021 03:09:31
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

The "Field" is not showing as "index" attribute - is point to the global order items and when it's used index="0" - it's trying to get information from 1st added product.

Connection "E2Pdf Template" to "WooCommerce" -> "Orders" is more designed to output "Order" information and all products data. For example it can be created E2Pdf "HTML" object ("Disable WYSIWYG Editor" option must be checked) and you must be able to iterate over all products and output product item meta data as with "Auto PDF": https://codeshare.io/xv7oML

If you need to generate PDF directly for specified product It will be more correctly to set "E2Pdf Template" connection to "WooCommerce" -> "Products" / "Variations" and use shortcode [e2pdf-wc-product key="breed_of_pet_" order_item_meta="true"] with that "E2Pdf Template". [e2pdf-download id="1"] shortcode in this case can be used as "File Download URL" under product or it can be used as attachment inside "Additional Mail Content" - [e2pdf-attachment id="1" dataset="1803"] - where "1803" is the Product ID.

However if you still want to show these data on the "Orders" E2Pdf Template - you can try to use:

[e2pdf-wc-product key="breed_of_pet_" order_item_meta="true" id="1803"] - where "1803" is the Product ID. The only limitation on such usage with stable version (1.16.44) that currently it will output data only for 1st product added with id="1803".

P.S. We also currently released an update to RC version (1.17.03) which can accept such construction:

[e2pdf-wc-product key="breed_of_pet_" order_item_meta="true" id="1803" index="0"] - it will output meta data for 1st product with ID "1803"

[e2pdf-wc-product key="breed_of_pet_" order_item_meta="true" id="1803" index=1"] - it will output meta data for 2nd product added with ID "1803"

You can follow steps to update to Latest RC version with current topic: https://e2pdf.com/support/desk/how-to-update-plugin-to-rc-release-candidate-version-from-e2pdf-com

We remain at your service.
We would really appreciate your feedback at WordPress.org!
15 November, 2021 07:54:47
pollrrm
Topics: 3
Messages: 8
Hi, thank you for your quick response. I tried your suggestions but they still don't seem to work.

To give you more details, please see screenshot https://prnt.sc/1zon4ns

I only want to use the fields from Product 3079 on all incoming orders. But if the Product 3079 is not the first product on the order, the fields are not showing with the current code I have.

Auto PDF code works fine but it displays the fields as a group. I actually want to display the fields individually (not as a group) is there a way to only pick specific PPOM fields from the Auto PDF code example?
15 November, 2021 08:04:28
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Did you update the plugin to RC Version 1.17.03?

If yes, which shortcodes did you try to use under E2Pdf Template?

P.S. Also the product added to "Order" - "Simple product", not "Variation"?
We would really appreciate your feedback at WordPress.org!
15 November, 2021 08:22:47
pollrrm
Topics: 3
Messages: 8
Yes, I updated teh plugin to RC Version 1.17.03

I tried these ones: I used name_of_pet_ instead of breed_of_pet_

[e2pdf-wc-product key="name_of_pet_" order_item_meta="true"]
[e2pdf-wc-product key="name_of_pet_" order_item_meta="true" id="3079"]

What I actually wanted to grab are the FORM FIELDS submitted on the PPOM Fields of Product 3079 on the every order (https://prnt.sc/1zon4ns) to be displayed individually because I am using a designed PDF and I want to fill it out with the said fields.

Yes, the product is a simple product and not a Variation.
15 November, 2021 08:36:13
E2Pdf
Support
Topics: 7
Messages: 3163
We understand the task that you are trying to complete.

Try please modify shortcode to:

[e2pdf-wc-product key="name_of_pet_" order_item_meta="true" id="3079" index="0"]

Using "id" + "index" attributes must output information for first product (index="0") with ID 3079 (id="3079") independent on the product global order.

We would really appreciate your feedback at WordPress.org!
15 November, 2021 09:32:17
pollrrm
Topics: 3
Messages: 8
Wow this works! Thank you so much for your help! Will leave a great feedback on Wordpress.org.

Appreciate it!