WooCommerce:在编辑订单上禁用日期 [英] WooCommerce: Disable Date on Edit Orders

查看:43
本文介绍了WooCommerce:在编辑订单上禁用日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Woocommerce的编辑订单"页面上禁用创建日期"文本框.我尝试做 pointer-events:none; ,但这没有用.

I need to disable the Date Created textbox on the Edit Orders page of Woocommerce. I try to do pointer-events: none; but it didn't work.

创建日期需要被禁用.

推荐答案

这对我有用...创建一个新的js文件并将其排入管理面板

This worked for me... Create a new js file and equeue it admin panel

/**
 * Enqueue a script in the WordPress admin, excluding edit.php.
 *
 * @param int $hook Hook suffix for the current admin page.
 */
function wpdocs_selectively_enqueue_admin_script( $hook ) {
    // if ( 'edit.php' != $hook ) {
    //     return;
    // }
    wp_enqueue_script( 'my_custom_woocommerce_script', get_template_directory_uri() . '/woocommerce/assets/meta-boxes-order.js', array(), '1.0' );
}
add_action( 'admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script' );

在js文件中,将此代码添加到下面

In the js file add this below code

jQuery(document).ready(function(){
    alert("ok"); // only for testing purpose that this file is loaded
    jQuery(".order_data_column_container .order_data_column p:eq(0) input").attr('disabled', true);
});

这篇关于WooCommerce:在编辑订单上禁用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆