woocommerce offtopic - Modifying custom order item meta from admin order view

I'd like to have a simple custom meta for order items that says if the item has been fulfilled or not.I have this i

I'd like to have a simple custom meta for order items that says if the item has been fulfilled or not.

I have this in my functions.php:

add_action( 'woocommerce_admin_order_item_values', 'pd_admin_order_item_values', 10, 3 );
function pd_admin_order_item_values( $product, $item, $item_id ) {
    //Get what you need from $product, $item or $item_id
    echo '<td class="fulfilled">';
    $fulfilled = wc_get_order_item_meta($item_id, '_fulfilled', true);
    if ($fulfilled) {
        echo '<p><strong>Fulfilled:</strong> <span style="color:#00FF00;">Yes</span></p>';
    } else {
        echo '<p><strong>Fulfilled:</strong> <span style="color:#FF0000;">No</span></p>';
    }
    echo'</td>';
}

Is there an easy way to update the meta value just by clicking the Yes/No?

Like, click the green Yes and it updates to a red No and viceversa.

Will I have to create a custom WC API endpoint?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745332537a4622948.html

相关推荐

  • woocommerce offtopic - Modifying custom order item meta from admin order view

    I'd like to have a simple custom meta for order items that says if the item has been fulfilled or not.I have this i

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信