Skip to content
Advertisement

Display vendor store-name (Dokan) on WooCommerce admin order preview

We add vendor information in the admin order details for each order via:

Now I also want to add this information also in the order preview. I found this answer

We change the hook to woocommerce_admin_order_preview_end but now when we want to open the preview nothing happend.

Do we have to adjust the whole code in order that it works for the order preview or why is our approach not working?

JavaScript

Advertisement

Answer

As already explained in the link you referred to (By LoicTheAztec). You can’t get the order object as it’s a template that loads specific data via Ajax and there is no arguments for woocommerce_admin_order_preview_start action hook

Instead the filter hook woocommerce_admin_order_preview_get_order_details will allow you first to add some custom data that you will be able to call and display it via woocommerce_admin_order_preview_start or woocommerce_admin_order_preview_end action hook

So you get:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement