我如何设置“背订”的样式:&quot。 - wp -admin中的文字 - >订单编辑?

发布于 2025-01-23 05:23:39 字数 1179 浏览 0 评论 0原文

我需要为WooCommerce在WP-ADMIN,订单编辑页面上打印“背订”文本的样式,最好是订单编辑,以及“订单快速查看”模式。

我的问题是没有类或ID可以针对我的CSS。

    <table cellspacing="0" class="display_meta">
     <tbody>
//  THIS FOLLOWING TR I NEED TO STYLE
       <tr> 
        <th>Backordered:</th>
          <td><p>2</p></td>
       </tr> 
// EOF
       <tr>
        <th>Cost of goods:</th>
         <td><p>8,17</p></td>
       </tr>
       <tr>
        <th>Purchase price:</th>
         <td><p>8,17</p></td>
       </tr>
     </tbody>
    </table>

我尝试使用一些这样的简单CS:

table.display_meta tr:first-child {
    color: red !important;
}

这确实有效,但是问题在于您可以从附件的图像中看到。我每个产品都打印几个元字段,因此当订单有许多订购线时,每个第一个TR的孩子显然会变红。

只想将备用样式的线条使它变得足够可见,这样仓库就不会启动包装过程。

我认为我需要添加一些课程,或者也许可以使用摘要来完成此操作。但是,即使是Google也不是我的朋友。我找不到任何例子。

如果我可以解决保留固定后排序产品的正确类ID,则还可以设计整个&lt; tr class =“ item”&gt;

有人吗?

I need to style the TR element where Woocommerce prints the "Backordered" text in wp-admin, Order edit page, preferably for both the order edit, and for the "order quick view" modal.

My problem is that there are no classes or id to target my css to.

    <table cellspacing="0" class="display_meta">
     <tbody>
//  THIS FOLLOWING TR I NEED TO STYLE
       <tr> 
        <th>Backordered:</th>
          <td><p>2</p></td>
       </tr> 
// EOF
       <tr>
        <th>Cost of goods:</th>
         <td><p>8,17</p></td>
       </tr>
       <tr>
        <th>Purchase price:</th>
         <td><p>8,17</p></td>
       </tr>
     </tbody>
    </table>

I tried using some simple CSS like this:

table.display_meta tr:first-child {
    color: red !important;
}

And that did work, but the problem is that as you can see from the attached image; I print several meta fields per product, so when the order has many orderlines, every first tr child will obviously turn red.

css child will not the trick

I only want style the backordered line, to make it visible enough so the warehouse don't start the packing process.

I think I need to add some classes, or maybe I can do this using a snippet. But even Google is not my friend here. I can't find any examples of this.

It would also be ok to style the entire <tr class="item"> that is wrapped around the entire line if I could address the correct class ID that holds the backordered product.

Anyone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲歌长辞 2025-01-30 05:23:39

您可以通过WooCommerce_Admin_htmin_html_order_item_item_item_item_class filter filter ocy &lt; tr&gt;在项目的&lt; tr; tr;中添加其他CSS类。

要将其添加到订单预览模式中,您可以使用woocommerce_admin_html_order_preview_item_class_class filter。

add_filter( 'woocommerce_admin_html_order_item_class', 'woocommerce_admin_html_order_item_add_backorder_class', 10, 3 );
add_filter( 'woocommerce_admin_html_order_preview_item_class', 'woocommerce_admin_html_order_item_add_backorder_class', 10, 3 );
function woocommerce_admin_html_order_item_add_backorder_class( $class, $item, $order ) {
    foreach ( $item->get_formatted_meta_data( '_', true ) as $meta_id => $meta_data ) {
        if ( strpos( $meta_data->key, 'Backordered' ) !== false ) {
            $class .= 'backordered-item';
            break;
        }
    }
    return $class;
}

You can add an additional CSS class to the item's <tr> when the item contains any item meta with a meta key of 'Backordered', via the woocommerce_admin_html_order_item_class filter.

To also add it to the order preview modal you can use the woocommerce_admin_html_order_preview_item_class filter.

add_filter( 'woocommerce_admin_html_order_item_class', 'woocommerce_admin_html_order_item_add_backorder_class', 10, 3 );
add_filter( 'woocommerce_admin_html_order_preview_item_class', 'woocommerce_admin_html_order_item_add_backorder_class', 10, 3 );
function woocommerce_admin_html_order_item_add_backorder_class( $class, $item, $order ) {
    foreach ( $item->get_formatted_meta_data( '_', true ) as $meta_id => $meta_data ) {
        if ( strpos( $meta_data->key, 'Backordered' ) !== false ) {
            $class .= 'backordered-item';
            break;
        }
    }
    return $class;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文