Display Invoice/Quote Link In Emails
-
Hello, for some reason the Invoice/Quote link isn’t appearing in the woocommerce email customer-quote / new-invoice template. I’ve tried adding this code below which give the button but doesn’t link to the order quote/invoice, just to my website domain. I added this code to my child themes email woocommerce processing order template.
<?php /** * Add content to the WC emails. * * @access public * @param WC_Order $order * @param bool $sent_to_admin * @param bool $plain_text */ function email_instructionss( $order, $sent_to_admin, $plain_text = true ) { $sliced_id = (int) sliced_woocommerce_get_invoice_id( sliced_woocommerce_get_object_property( $order, 'order', 'id' ) ); $btn_text = sprintf( __( 'View this %s online', 'sliced-invoices' ), sliced_get_the_type( $sliced_id ) ); $color = get_option( 'woocommerce_email_base_color' ); $base_text = wc_light_or_dark( $color, '#202020', '#ffffff' ); echo "<br><a href='" . esc_url( sliced_get_the_link( $sliced_id ) ) . "' style='font-size: 100%; line-height: 2; color: " . $base_text . "; border-radius: 3px; display: inline-block; cursor: pointer; font-weight: bold; text-decoration: none; background: " . $color . "; margin: 20px 0 10px 0; padding: 0; border-color: " . $color . "; border-style: solid; border-width: 7px 15px;'>" . esc_html( $btn_text ) . "</a>"; } add_action( 'woocommerce_email_order_meta', 'email_instructionss', 50, 3 ); ?>
Here’s how the code appears: https://prntscr.com/vb8htl
Example of how the link should direct to https://my.domain.com/sliced_invoice/order-id-#/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display Invoice/Quote Link In Emails’ is closed to new replies.