• Resolved Mikey

    (@mikeyhash)


    Hi,

    I am trying to customize the orders.php template and I want to echo a custom string message on a new column of the Orders table when the commission for one (or more) of the vendor’s product(s) is “paid”.

    In other words, when I mark as “paid” in backend and the Status thus changes to “paid”, a message should be echoed.

    Can you please help me with the condition? It should be something like “If the vendor’s product’s commission status is “paid” for the respective order displayed in Orders table, echo something”. I’ve been trying for so many hours now, but I simply can’t get the hang of it because I’m not familiar with the WC Vendors’ internal functions and queries.

    This is what I’ve tried but with no luck:

    <?php foreach ( $order_summary as $order ) :

    $order = wc_get_order( $order->order_id );
    $order_id = $order->get_id();
    $valid_items = WCV_Queries::get_products_for_order( $order_id );

    if ($valid_items->status == ‘paid’) { // DOES THIS WORK?
    echo ‘Something’;
    }
    ?>

    Pretty please help.

    • This topic was modified 6 years, 6 months ago by Mikey.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Mikey

    (@mikeyhash)

    I’ve been searching a lot for a solution to my objective but with no results.

    Now I just found this discussion right here: https://www.wcvendors.com/help/topic/showing-paid-orders-in-vendor-dashboard/

    What the guy is asking there is exactly what I want for my site as well.

    My vendors need to easily see in their Orders table which order (with the corresponding products of the vendor) is “Due” and which is “Paid”.

    So, NOT the status of the order (processing/completed), BUT the status of each product as they are marked in admin WC Vendors -> Commissions.

    For instance, if there is an order with 5 products out of which 3 belong to Vendor A and 2 belong to Vendor B, when I manually mark in backend ALL 3 products of Vendor A, then he should see in its Orders table the status “paid” for the respective order row. At the same time, if I haven’t yet marked as “paid” the 2 products of Vendor B, the latter should see “due” in his Orders table for the respective order row.

    Since I’m not the only one wanting this, maybe you could consider it as rather important.

    Can you please help?

    Hello,

    We do not provide support for custom development but we will try and point you in the right direction. The template provides the order number, so you can use the order number to query the commission table and get the relevant order and product id status and then echo it.

    You will need to query the commission table directly to get the information.

    cheers,

    Jamie.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Please help to customize Orders table template’ is closed to new replies.