Rendre content from related post select field

13 February, 2025 04:35:29
eliodata
Topics: 18
Messages: 54
Hi,

This code works well to render the text field content from fsbdd_inter_numero :
[e2pdf-wp id="dynamic" key="fsbdd_inter_numero" meta="true" parent="true"][e2pdf-wc-order key="line_item" subkey="fsbdd_relsessaction_cpt_produit" index="0" order_item_meta="true"][/e2pdf-wp]

But this none doesn't for the select field fsbdd_select_lieuforminter :
[e2pdf-wp id="dynamic" key="fsbdd_select_lieuforminter" meta="true" parent="true"][e2pdf-wc-order key="line_item" subkey="fsbdd_relsessaction_cpt_produit" index="0" order_item_meta="true"][/e2pdf-wp]

Both fields are into the same metabox from the same cpt.

[e2pdf-wc-order key="line_item" subkey="fsbdd_select_lieuforminter" index="0" order_item_meta="true"] works well to render the same field saved into order line items metas.

any idea please ?
13 February, 2025 04:53:30
E2Pdf
Support
Topics: 7
Messages: 3413
Hello,

The shortcode looks correct if the field is in the same group as fsbdd_inter_numero.

Does it output anything when you place the shortcode into the separate "textarea", or is it just an empty output?
We would really appreciate your feedback at WordPress.org!
13 February, 2025 05:07:36
eliodata
Topics: 18
Messages: 54
I have tried into empty input or text fields. Looking at the cpt metadatas I see this:

fsbdd_select_lieusession: Array ( [0] => adress content xxxxx )

I remember this select field is conditionnal logic. it depends on another select : fsbdd_typesession
13 February, 2025 05:22:32
E2Pdf
Support
Topics: 7
Messages: 3413
E2Pdf is not related to conditional logic. If it is visible when you edit the product page and displays the correct value, it should output that value via the [e2pdf-wp] shortcode.

Do you need to output the value set in the Product/Variation page, or do you need to output the value selected by the user upon purchase?

Additionally, could you please clarify—did you get a completely empty output? It seems we couldn't find the answer in your previous message.
We would really appreciate your feedback at WordPress.org!
13 February, 2025 05:28:30
E2Pdf
Support
Topics: 7
Messages: 3413
P.S. If [e2pdf-wc-order key="line_item" subkey="fsbdd_select_lieuforminter" index="0" order_item_meta="true"] outputs the correct value you need, and your E2Pdf Template is connected to WooCommerce → Products/Variations, then we assume you just need to use the shortcode:

[e2pdf-wc-product key="fsbdd_select_lieuforminter" order_item_meta="true"]
We would really appreciate your feedback at WordPress.org!
13 February, 2025 10:32:55
eliodata
Topics: 18
Messages: 54
Thank you for the quick answers!

The field "fsbdd_select_lieuforminter" can originate from two sources:

The custom post type (CPT) related to the product in the order via subkey="fsbdd_relsessaction_cpt_produit".
The meta line items saved during the order.
The field "fsbdd_select_lieuforminter" can be modified directly from its CPT, but this does not affect the line items. Therefore, you need to retrieve it from the CPT. This logic is similar to "fsbdd_inter_numero," which does not pose any issues.

>> did you get a completely empty output?
yes, sorry for my poor english.

I finally managed to force the line items meta to sync with the cpt if updated. So no more problem now, just use [e2pdf-wc-order key="line_item" subkey="fsbdd_select_lieuforminter" index="0" order_item_meta="true"] to render the updated field data.

best regards