• Resolved j007w

    (@j007w)


    Hi,

    Thanks for making this plugin! The updates since I last checked months ago are very welcomed.

    Are there any plans to add order items added by the official WooCommerce Checkout Addon plugin? According to Woo: “These fee items are added as order line items, so you could access this data via the order line items.”. However, none of these add-on items are printed.

    Also, is it possible to show each product without tax added to the price. I was able to add the tax amount above the total, per instructions from another thread. However, the receipt makes no sense due to each product showing the tax included in the prices.

    Thanks so much!

    Joseph

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @j007w
    It’s good to hear that the plugin is mostly working for you. I’m working on a large update now, version 2.1, which will make the plugin translatable and also very customisable by theme/plugin developers. But this does make it a little difficult for me to release a quick fix. However, I think these can be solved with some small edits on your site.

    Firstly, to print item prices without tax, find the function “star_cloudprnt_print_items()” in “order-handler.php”, and locate these two lines:

    $item_total_price = floatval(wc_get_order_item_meta($item_id, "_line_total", true))
      +floatval(wc_get_order_item_meta($item_id, "_line_tax", true));

    Which just needs to be replaced with:
    $item_total_price = floatval(wc_get_order_item_meta($item_id, "_line_total", true));

    Secondly, I have not tested WooCommerce Checkout Add-on (I assume it’s this one?), and don’t have access to that plugin, but, we have recently started to keep a [registry of compatible plugins](https://github.com/star-micronics/star-cloudprnt-for-woocommerce/wiki/Plugin-Compatibility) on the projects wiki page, so appreciate the feedback.

    According to the WooCommerce Checkout Add-on developer documentation, these checkout add-ons are all added as additional fees to the order, which we don’t currently support. If you would like to try adding in some support though, it should be quite easy thankfully.
    You can add the following code to the function named “star_cloudprnt_print_item_totals()”, in “order-handler.php”. Place it where you would like these to show up (I guess just above the tax part that you added).

    $fees = $order->get_fees();
    foreach($fees as $fee) {
      $value = $fee->get_total() - $fee->get_total_tax();
      $ft($fee->get_name(), $value);
    }

    This attempts to print the fee without tax (which I guess you will prefer), but the WooCommerce documentation isn’t clear if get_total() already includes tax or not, and my test site isn’t well set-up to check this. So you may want to play with the $value = $fee->get_total() - $fee->get_total_tax(); to print exactly the value that you need.

    I’d really appreciate any feedback on these modifications, especially so that I can update our plugin compatibility page with the correct advice, and try to make sure that the 2.1 release can work for you without needing code modifications..

    Thread Starter j007w

    (@j007w)

    Hi Lawrence,

    Hope you’re having a great day.

    Thanks so much for your detailed info. I really appreciate you!

    Following your instructions, I was able to show product prices without tax and add the checkout add-on items on the receipt. I found out that the $fee->get_total() itself is without the tax so I removed the - $fee->get_total_tax() and it’s working great.

    Thanks again!

    Joseph

    Thread Starter j007w

    (@j007w)

    Hi Lawrence,

    Sorry to bother you again. I was wondering if you wouldn’t mind helping me a bit more on this subject.

    I noticed a small piece of info is missing. Specifically, the values (not fee value) of the add-ons fields are missing. This value can be a text, checkbox, select, etc.

    For example, one of the checkout addon fields is a select field intended for tips. It has options such as “10%”, “20%”, etc. The receipt is showing the name “Tips” and the amount of $0 but it’s not showing “10%”.

    The WooCommerce email as well as order info on the website are showing “Tips: 10%”. Is there any way you could help me modify the code so the missing “10%” selected option will also show on the printed receipts?

    I found that the checkout addon field (“Tips”) is stored in the order_item_name column in the woocommerce_order_items table. The selected option (“10%”) is stored in the meta_value column with its meta_key being _wc_checkout_add_on_label and is in the woocommerce_order_itemmeta table.

    Thanks again for all you do!!

    Joseph

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @j007w

    Thanks for figuring out that the price was excluding tax, I’ve made a note of that for the fee support in version 2.1.

    Also thanks for looking in to where the label is held. this is usually 99% of the work required in adding something new to the receipt.

    if it is stored in woocommerce_order_itemmeta then you should be able to access it with the get_meta() from each WC_Order_Item_Fee object.

    So, try something like this (disclaimer, I am not currently able to test this).

    $fees = $order->get_fees();
    foreach($fees as $fee) {
      $value = $fee->get_total();
      $value_postfix = "";
      if($fee->meta_exists("_wc_checkout_add_on_label");
        $value_postfix = " (" . $fee->get_meta("_wc_checkout_add_on_label") . ")";
      $ft($fee->get_name(), $value . $value_postfix);
    }

    Hopefully that will work, and is enough for you to adjust the output as you’d like to see it.

    Thread Starter j007w

    (@j007w)

    Hi @lawrenceowen

    Thank you so much for your code. I’m able to get the selected value showing on the receipt. You’re the best! I really appreciate your incredible support.

    Hope you’ll have a great rest of the weekend.

    Joseph

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @j007w

    Great, thanks for letting me know ?? Thankfully it was a holiday on Monday here in the UK, so a nice long weekend.

    Just for your information, from the 2.1.x version, you will not be able to just drop in these changes, since the base source is being re-arranged quite a bit, so that external plugins can modify the document, without needing to customise our plugin.

    The good news, is that you’ll be able to place your changes in a separate theming plugin that will not need to be adapted every time we publish an update. I’ll also have fee support built-in as standard, as well as an option to print item prices without tax, so hopefully there will be less need for any customisation – supporting the fee label from WooCommerce Checkout Add-Ons may be the only concern.

    So, when we release the 2.1 update, please have a backup of your modified version of the plugin, so that you can easily roll back if needed. And please don’t feel that you must update immediately.

    Thread Starter j007w

    (@j007w)

    Hi @lawrenceowen,

    Thanks for the heads-up. Sounds like an exciting update is coming soon. I’ll be sure to make a backup before updating.

    Appreciate you!

    Joseph

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Official checkout addon’ is closed to new replies.