Hi Darren, hi Condless,
I finally figured out how to get what I need.
To explain you (and for other people interested) further my needs:
– I need to get price by kg (as mentionned in the topic)
– I also needed to get pickup datetime displayed on the invoice (plugin XXX)
To do so, I finally figured out there was an option to display quantity with the premium plugin (which like Condless said, is the order item cost), so this what easily solved whit the invoice configurator.
However, to display pickup datetime it was a bit tricky. The order data I could normally used for it is, as I understood, {{local_pickup_plus_pickup_details}}
.
Usually you just have to create a text block in the invoice configurator but in my case nothing is displayed. I don’t know if it is a plugin issue or a misconfiguration on my side.
the solution I found was to create my own template by copy-pasting a template into my custom theme (woocommer/pdf/template/mytemplate) and then add the following code:
<table>
<tbody>
<?php foreach ( $this->get_woocommerce_totals() as $key => $total ) : ?>
<tr class="<?php echo esc_attr( $key ); ?>">
<th class="description"><?php echo esc_html( $total['label'] ); ?></th>
<td class="price"><span class="totals-price"><?php echo wp_kses_post( $total['value'] ); ?></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
the bad side on that is that you cannot use the invoice configurator for the totals but that’s the only working solution I found for now. (If you have any solution to make the order data work I am interested ??)
Thanks you two Darren and Condless for your help.
I hope this post will help other people there.
-
This reply was modified 2 years, 1 month ago by Pierre Mathelin. Reason: Code formatting
-
This reply was modified 2 years, 1 month ago by Pierre Mathelin. Reason: Code formatting