enoch008
Forum Replies Created
-
Is this plugin abandoned?
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Get order meta to the invoiceFor those who have the same need I have solved this way:
I added a new hook in the custom template to show what i ned in the right position (in my case under the total amount) like this:
<?php do_action( 'wpo_wcpdf_after_total_price', $this->get_type(), $this->order ); ?>
And i added this to function.php:
add_action( 'wpo_wcpdf_after_total_price', 'wpo_wcpdf_meta3', 10, 2 ); function wpo_wcpdf_meta3( $template_type, $order ) { $user = $order->get_user(); if ( in_array( 'convenzionato', (array) $user->roles ) ){ ?> <tr class="sconto"> <th class="description">Sconto convenzione</th> <td class="price"><span class="totals-price"><?php echo $order->get_meta('_sconto_convenzione'); ?></span></td> </tr> <?php } }
Thanks so much Yordan for helping me, maybe you can edit the post title to help other users.
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Get order meta to the invoiceThe user role is certainly correct, its a custom user role named convenzionato. Its certainly correct cause i used it in other functions.
That’s the part of the template that i try to edit:<td class="no-borders" colspan="2"> <table class="totals"> <tfoot> <?php foreach ( $this->get_woocommerce_totals() as $key => $total ) : ?> <tr class="<?php echo $key; ?>"> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?> <?php $user = $order->get_user(); if ( in_array( 'convenzionato', (array) $user->roles ) ) { <tr class="sconto"> <th class="description">Sconto convenzione</th> <td class="price"><span class="totals-price"><?php echo $order->get_meta('_sconto_convenzione'); ?></span></td> </tr> } ?> </tfoot> </table> </td>
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Get order meta to the invoiceThanks!
I tried adding this to the custom template but it doesnt work.<?php $user = $order->get_user(); if ( in_array( 'customer', (array) $user->roles ) ) { <tr class="sconto"> <th class="description">Sconto convenzione</th> <td class="price"><span class="totals-price"><?php echo $order->get_meta('_sconto_convenzione'); ?></span></td> </tr> } ?>
Forum: Plugins
In reply to: [MultiStep Checkout for WooCommerce] Feedback & issues in latest versionsPlease translate also the coupon phrase.
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Get order meta to the invoiceHi, thanks for taking the time to respond to me.
I added the following code to the custom template that I’ve created.<tr class="sconto"> <th class="description">Sconto convenzione</th> <td class="price"><span class="totals-price"><?php echo $order->get_meta('_sconto_convenzione'); ?></span></td> </tr>
It works, but is there a way to display it based on user role?
- This reply was modified 2 years, 6 months ago by enoch008.