Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make visible columns settings visible based on template type (B2B & B2C) #190

Closed
baselbers opened this issue May 30, 2017 · 4 comments
Closed

Comments

@baselbers
Copy link
Owner

baselbers commented May 30, 2017

https://wordpress.org/support/topic/filter-for-invoice-columns/

@mjke87
Copy link

mjke87 commented May 31, 2017

The main problem is, that the template_options get loaded only once, early on, and are static thereafter. Perhaps creating a get_template_option function that takes the option key as parameter would be a possible solution. Inside of this function we could introduce a filter. This would allow to filter any kind of template option, dynamically.

@baselbers
Copy link
Owner Author

I will make sure that there will be a filter within below method.
https://github.com/baselbers/woocommerce-pdf-invoices/blob/v2.9.1/includes/woocommerce-pdf-invoices.php#L727

@baselbers
Copy link
Owner Author

As of version 2.9.2 it will be able to change option value. For example when getting the customer notes.

if ( WPI()->get_option( 'template', 'show_customer_notes' ) ) {
echo "This is a customer note";
}

Use filter like below to change the option value for specific order or invoice data using WPI()->templater().

function disable_customer_notes( $option ) {
	$order = WPI()->templater()->get_order();

	if ( $order ) {
		// Do something with order or templater.
		$option = 0;
	}

	return $option;
}
add_filter( 'bewpi_pre_option-template-show_customer_notes', 'disable_customer_notes' );

@girivasanit2sbc
Copy link

How to add Customer email in invoce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants