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

Enable for custom order types #415

Open
bazalt opened this issue Oct 11, 2022 · 4 comments
Open

Enable for custom order types #415

bazalt opened this issue Oct 11, 2022 · 4 comments

Comments

@bazalt
Copy link

bazalt commented Oct 11, 2022

Hi, and thank you for this amazing plugin.
I'm currently working on a custom WooCommerce order_type (declared with wc_register_order_type()).
Unfortunately, these custom order types are presently not handled by PDF Invoices & Packing Slips plugin.
Is this something that could be considered?

@alexmigf
Copy link
Member

Hi @bazalt

We could yes, maybe passing it using a filter in a custom function.

Are you extending the order class as well?

@bazalt
Copy link
Author

bazalt commented Oct 11, 2022

Are you speaking about the \WPO\WC\PDF_Invoices\Compatibility\Order class ? Not yet, and I don't have enough perspective about a potential future necessity. However, I'm curious: which method would you recommend to extend this class?

Until then, I identified a couple of bottlenecks:

  • \WPO\WC\PDF_Invoices\Assets::is_order_page should allow custom order types to allow loading backend assets
  • Object found is not an order! is returned by \WPO\WC\PDF_Invoices\Settings::ajax_preview when previewing one of these custom order post

@alexmigf
Copy link
Member

I was referring the actual WooCommerce abstract order class: https://woocommerce.github.io/code-reference/classes/WC-Abstract-Order.html

Until then, I identified a couple of bottlenecks:

Until we implement this you probably see some errors here and there.

@bazalt
Copy link
Author

bazalt commented Oct 11, 2022

So my response is yes: I'm actually extending WC_Order, which extends WC_Abstract_Order. Mainly just to implement get_type() method.

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

No branches or pull requests

3 participants