Pepro Dev. Group
Forum Replies Created
-
You shouldn’t use this code directly! this was just a demonstration of how to use WooCommerce API Functions to get price of a product.
I’m sorry but you need at least minimum knowledge of PHP and WordPress APIs to use those codes.
Yours,
AmirhosseinHi, Could you please send me the code that generated error below:
Uncaught Error: Call to a member function get_variation_prices() on null in /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/pl ….
Hi, withing next week new release will be published.
Thanks
It is preferable to add your snippets in a custom plugin or Theme’s function.php file.
and get_variation_prices should be called on a product, that means you have to initiate WC_Product class with given ID.Please send me your complete code so I could find the problem.
Have a nice day.
Good evening,
I think what you need are the following functions, Please Let me know if there’s anything else I can help you with.
// All prices: multidimensional array with all variation prices (including active prices, regular prices and sale prices). $prices = $product->get_variation_prices(); $prices_for_display = $product->get_variation_prices( true ); // For display // The min or max active price. $min_price = $product->get_variation_price(); // Min active price $min_price_for_display = $product->get_variation_price('min', true); // Min active price for display $max_price = $product->get_variation_price('max'); // Max active price $max_price_for_display = $product->get_variation_price('max', true); // Max active price for display // The min or max regular price. $min_price = $product->get_variation_regular_price(); // Min regular price $min_price_for_display = $product->get_variation_regular_price('min', true); // Min regular price for display $max_price = $product->get_variation_regular_price('max'); // Max regular price $max_price_for_display = $product->get_variation_regular_price('max', true); // Max regular price for display // The min or max sale price. $min_price = $product->get_variation_sale_price(); // Min sale price $min_price_for_display = $product->get_variation_sale_price('min', true); // Min sale price for display $max_price = $product->get_variation_sale_price('max'); // Max sale price $max_price_for_display = $product->get_variation_sale_price('max', true); // Max sale price for displayHi, I didn’t quite understand your problem but I’m sure you can do any manipulation to invoices by just looking into WordPress and WooCommerce code-base and documentations.
We used functions to print order totals and added hooks to the output of those functions, so you can modify it. Check below links:
for HTML invoice: https://github.com/peprodev/ultimate-invoice/blob/8115f8c65e1a08a9e1e50bb1d7add4dcf4c7bfc4/include/admin/class-print.php#L1551
/** * Filter Pepro Ultimate Invoice Order Row item's value * * @author Amirhosseinhpv ( @amirhosseinhpv ) */ add_filter( "puiw_printinvoice_create_html_item_row_metas", "make_zero_look_empty", 99, 5); /** * output empty string instead of zero with currency when price is empty * * @method make_zero_look_empty * @param array $item_details * @param int $item_id Current item's ID in Order items loop * @param WC_Order_Item $item Current item's instance in Order items loop * @param int $product_id Parent product in Order loop * @param WC_Order $order Current Order instance * @return array modified row data * @version 1.0.0 * @license https://pepro.dev/license Pepro.dev License */ function make_zero_look_empty($item_details, $item_id, $item, $product_id, $order ) { // current item's calculated price if ( $order->get_item_subtotal( $item, false, true ) <= 0 ){ $item_details["base_price"] = ""; $item_details["nettotal"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_price "; } // current item's calculated tax if ( $item->get_subtotal_tax() <= 0 ){ $item_details["tax"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_tax "; } // current item's calculated discount if ( (float) $item_details["discount"] <= 0 ){ $item_details["discount"] = ""; $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_discount "; } return $item_details; }Sorry dear, code is fixed.
https://github.com/peprodev/ultimate-invoice/wiki/Filter-Order-Row-item-value
Hello @sidneyts , Hope you’re well.
I’ve created a sample for you: https://github.com/peprodev/ultimate-invoice/wiki/Filter-Order-Row-item-value
Hope this does the trick,
Let me know if there’s anything else you need help with.Kind regards,
Amirhossein- This reply was modified 4 years, 11 months ago by Pepro Dev. Group.
Forum: Reviews
In reply to: [PeproDev Ultimate Invoice] عالی هستیدسلام، سپاسگزاریم از محبت شما
خوشحالیم مشکل تون حل شدHi @sidneyts ,
——–
1- you can hook intopuiw_printinvoice_create_html_item_row_metaswhich is located inpepro-ultimate-invoice\include\admin\class-print.phpand change row item’s meta or values.
——–
2- Classes are defined in template files, look those up inpepro-ultimate-invoice\template.
——–
3- You can hook into WooCommerce built-in action hooks (woocommerce_checkout_order_processed, woocommerce_new_order) to fire an event when order is received, but for the WhatsApp part, I’m not sure weather WhatsApp has an API for such demands, but don’t give up and search for it.Sincerely yours,
Amirhossein- This reply was modified 4 years, 11 months ago by Pepro Dev. Group.
Hello, only valid images could be uploaded, for security reason we even check image’s content to make sure it’s really an image.
In the next release, we plan to add support for PDF files too.
Thanks for using our products.Hello @sidneyts , Hope you’re doing well.
Plugin is fully translatable but invoices’ translation are read from template files. To translate invoices into your own language or edit template files, you should follow steps below:
1- Make a child-theme of your current theme and activate it
2- Copy default folder from wp-content\plugins\pepro-ultimate-invoice\template\default to your child-theme
3- Edit default.cfg file from folder you’ve just copied and change Name and Designer and Version
4- Edit function.php in child-theme and add code below:
// Add customized template to Ultimate Invoice add_filter( "puiw_get_templates_list", function ($templates){ $templates[] = get_stylesheet_directory() . '\default\default.cfg'; return $templates; }, 10, 1);5- Now go to Ultimate Invoice setting > Theming Section > Change Default Theme to your new theme and Save
At this point, you’ve successfully added a new template to your invoices and you are free to edit this template as much as you need.
Please note that if you need to add Macros in your template .tpl files (like
sku) you can use hook below:// Add new Macro to Ultimate Invoice templates add_filter( "puiw_get_default_dynamic_params", function ($macros, $order){ $macros["new_macro"] = 'Value Comes Here -- use $order to access WC_Order'; return $macros; }, 10, 2);For example you need to add Order ID macro as my_order_id which returns Woocommerce Order ID, use code below:
// Add <code>my_order_id</code> as Woocommerce Order ID to Ultimate Invoice templates // You can also pass multiple macros at once (my_second_macro, my_third_macro) add_filter( "puiw_get_default_dynamic_params", function ($macros, $order){ $macros["my_order_id"] = $order->get_id(); $macros["my_second_macro"] = 'my_second_macro'; $macros["my_third_macro"] = 'my_third_macro'; return $macros; }, 10, 2);If you had any problems or needed more help, please don’t hesitate and let us know.
Yours sincerely,
Amirhossein, CTO at Pepro Dev- This reply was modified 5 years ago by Pepro Dev. Group.
- This reply was modified 5 years ago by Pepro Dev. Group.
- This reply was modified 5 years ago by Pepro Dev. Group.
- This reply was modified 5 years ago by Pepro Dev. Group.
Forum: Plugins
In reply to: [PeproDev Ultimate Invoice] [province] tag doesn’t workمیتونید از توسعه دهنده افزونه حمل و نقل بخواهید این مورد رو حل کنند.
متشکرم