Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter clickmac

    (@clickmac)

    If the hook could also pass the $order. That will be great.

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Clickmac,
    I will add this to the wishlist for the next version! I am not sure if I will be adding it, because I want hooks to be compatible between the free and premium templates too and what you propose is probably not compatible. But I may change the free template so that it works the same as the premium templates. Keep an eye on the changelog!

    Have a fantastic day!
    Ewout

    Thread Starter clickmac

    (@clickmac)

    I am requesting this, to make another plugin compatible with yours, which will bring more awareness to the your plugin.

    Perhaps saving the values in an array and outputting the data can work?
    Then perhaps, make an filter where I can hook into it and add new fields?

    Just would like to add new fields without recreating a whole different template as there are many fields to be added, to much…

    Is there another way.

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Clickmac,
    Just wanted to give you a heads up on this!

    The latest version of the template has changed in some parts and I have added the actions you requested. Below is an example of how to use them. As you can see the action has two parameters, the template type and the order object.

    Hope that helps!

    /**
     * Add shipping method to invoice order data
     */
    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_after_order_data', 10, 2 );
    function wpo_wcpdf_after_order_data ( $template_type, $order ) {
    	global $wpo_wcpdf;
    	if ( $template_type == 'invoice') {
    		?>
    		<tr class="shipping-method">
    			<th><?php _e( 'Shipping Method:', 'wpo_wcpdf' ); ?></th>
    			<td><?php $wpo_wcpdf->shipping_method(); ?></td>
    		</tr>
    		<?
    	}
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Request to add a do_action hook’ is closed to new replies.