• Resolved roccinio

    (@roccinio)


    Hello,

    I am trying to figure out how to print the extra discount on takeaway from a plugin. I contacted the plugin author to give me advice regarding how to achieve that and i got this answer:

    You should contact with support of Star printer and ask them support display Fee of order then it will works fine
    If you still want to get fee/discount, you can use this custom code:

    $order = new WC_Order( $order_id );
    $discount_fee = $order->get_total_fees();`

    For the love of me i cant figure out how to implement it here and make it work:

    if($order_meta['_cart_discount'][0] != 0)
    			$ft("DISCOUNT", -$order_meta['_cart_discount'][0])
                            
                            $ft("TOTAL", $order_meta['_order_total'][0]);

    Regards

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

    (@lawrenceowen)

    @roccinio Apologies for the slow response, I’ve had a few days off work.

    I’ll add general support for fees to our feature request list, but for now, you can add it in. This advice is based on the current 2.0.3 release.

    It looks like you have located the correct place to add this, in the function named “star_cloudprnt_print_item_totals()”, in the file “order-handler.php”.

    The correct way to print the total fee would be:
    $ft("DISCOUNT", $order->get_total_fees());

    You can change the “DISCOUNT” string to whatever suits your site.

    Thread Starter roccinio

    (@roccinio)

    You are a Rockstar!

    And i am happy you got a few days off to rest.
    Keep up the good work.

    Cheers!

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @roccinio

    Great, thanks for letting me know it’s working ??
    I’ll make sure that general support for fees is included in the future, so hopefully, there will be no need for you to modify it yourself in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with printing a discount from a plugin’ is closed to new replies.