Woocommerce variable product custom fields (metabox.io)

WooCommerce
11 March, 2022 02:45:36
j.durand
Topics: 8
Messages: 29
Hi,
I'm trying to map some products custom fields created with metabox.io plugin.
It's an order template, the pdf is well attached to email. But custom fields are not displayed. I tried to paste them with visual mapper (they are in the list), and manually like this:

[e2pdf-wc-product key="mycustomfield_id" meta="true" index="0"]

but no result...

Can you help please?
11 March, 2022 03:46:56
E2Pdf
Support
Topics: 7
Messages: 3345
Hi

Update please plugin to latest RC version by following steps in current topic: https://e2pdf.com/support/desk/how-to-update-plugin-to-rc-release-candidate-version-from-e2pdf-com as it has more integration with WooCommerce and extended shortcodes with "Visual Mapper".

P.S. If this is input fields which filled upon order, in most cases the shortcodes will look like this. Screenshot attached:

[e2pdf-wc-product key="Dropdown" order_item_meta="true" index="0"]

But it can be different with metabox.io as we didn't test it. If you still fail with render data attach please metabox.io plugin so we can install it and check on our side or you can submit support ticket with access details to WP Admin Dashboard here: https://e2pdf.com/support/request so we can login and try to recognize correct structure.
We would really appreciate your feedback at WordPress.org!
11 March, 2022 04:28:05
j.durand
Topics: 8
Messages: 29
Thank for the quick support!
No change with latest release.
I have another template using metabox but not Woocommerce, it works well with this code:
[e2pdf-wp key="mycustomfield_id" meta="true"]

If you can't help here I will send you admin access.

best regards
11 March, 2022 04:34:56
j.durand
Topics: 8
Messages: 29
Ok my bad. It works but only for simple products (my custom fields don't depend on attributes, they are the same for all options).
Other problem, if there is more than one product the pdf displays only the custom fields for the first product.
11 March, 2022 05:18:04
E2Pdf
Support
Topics: 7
Messages: 3345
If E2Pdf Template connected to WooCommerce Orders then attributes which you get from product must be controlled with "index" attribute as:

[e2pdf-wc-product key="mycustomfield_id" meta="true" index="0"] - 1st product
[e2pdf-wc-product key="mycustomfield_id" meta="true" index="1"] - 2nd product
[e2pdf-wc-product key="mycustomfield_id" meta="true" index="2"] - 3rd product

and so on...

As an alternative you can try to use foreach structure as:

[e2pdf-foreach shortcode="e2pdf-wc-order" key="get_items"]
[e2pdf-wc-product key="mycustomfield_id" meta="true" index="[e2pdf-foreach-index]"]
[/e2pdf-foreach]
We would really appreciate your feedback at WordPress.org!
11 March, 2022 05:37:12
j.durand
Topics: 8
Messages: 29
I understand. Tried (index="1) juste before your answer and works.
But only for simple products. I have many variable products (events), and still can't display fields content:

https://formationstrategique.fr/catalogue/catalogue-formations/logistique/formation/habilitation-electrique-non-electricien-h0v-b0-ou-h0v-b0-bs-be-manoeuvre/?attribute_pa_sessions-dispo-inter-intra=mars-14-et-15-inter-entreprises

The custom fields are under the product description.

Thank you again
11 March, 2022 07:15:22
j.durand
Topics: 8
Messages: 29
I confirm. I have tried with very simple variable product (1 attribute, 2 variations) and:

[e2pdf-wc-product key="mycustomfield_id" meta="true" index="0"]

doesn't work.
11 March, 2022 07:33:02
E2Pdf
Support
Topics: 7
Messages: 3345
Do you wish to show PDF on frontend directly with the link below?

https://formationstrategique.fr/catalogue/catalogue-formations/logistique/formation/habilitation-electrique-non-electricien-h0v-b0-ou-h0v-b0-bs-be-manoeuvre/?attribute_pa_sessions-dispo-inter-intra=mars-14-et-15-inter-entreprises

If so, then E2Pdf Template must be connected to "WooCommerce" -> "Variations" and [e2pdf-download id="1"], where 1 is the ID of that E2Pdf Template - must be added to "Variation" description instead of "Product" description or "dataset" must be set to "Variation ID" dynamically.

However you must keep in mind that E2Pdf can't currently dynamically show fields like "session" outside "Variable" product. It can show attributes only if it's part of "Variation", when "Ajouter au devis" is active.


We would really appreciate your feedback at WordPress.org!
11 March, 2022 07:41:06
j.durand
Topics: 8
Messages: 29
>> Do you wish to show PDF on frontend directly with the link below?
No, sorry for my poor english!

My issue is still the same as my first comment. The pdf is attached in order email. I can't display custom fields in the pdf for variable products. The link to my product was an example. The fields I need are simple text fields, the ones under "À propos de la formation".

Your code and visual mapper works for simple products but not for variable products.
11 March, 2022 07:42:29
E2Pdf
Support
Topics: 7
Messages: 3345
Can you try to replace it with:

[e2pdf-wc-product key="get_attribute" attribute="pa_attribute" show="value" index="0"]

"pa_attribute" must be replaced with your attribute key and must be available inside "Visual Mapper". If still not work, submit please support ticket with access details: https://e2pdf.com/support/request
We would really appreciate your feedback at WordPress.org!
11 March, 2022 07:46:26
E2Pdf
Support
Topics: 7
Messages: 3345
À propos de la formation?

If so, as we understand it's product data and not variable data. One more possible construction to set "parent" attribute to true to get data from parent product directly:

[e2pdf-wc-product key="mycustomfield_id" meta="true" index="0" parent="true"]
We would really appreciate your feedback at WordPress.org!
11 March, 2022 08:26:02
j.durand
Topics: 8
Messages: 29
>> If so, as we understand it's product data and not variable data. One more possible construction to set "parent" attribute to true to get data from parent product directly

Yes!!! That's exactly what I tried to say with my poor vocabulary :)

parent="true" Works like a charm. Sorry for the wasted time and many thank for the quick, kind and efficient support!
11 March, 2022 08:27:23
j.durand
Topics: 8
Messages: 29
May be you could add "variable products" in the post title for better search results.
11 March, 2022 08:29:12
E2Pdf
Support
Topics: 7
Messages: 3345
Thanks. We will do. Glad to here that it was found solution.
We would really appreciate your feedback at WordPress.org!