【问题标题】:How can i remove extra div html class in checkout forms field in woo commerce如何在 woo commerce 的结帐表单字段中删除额外的 div html 类
【发布时间】:2021-05-02 09:49:43
【问题描述】:

我想删除结帐表单字段中的额外 html。例如,我想在结帐字段中删除 'woocommerce-input-wrapper spanP 标记。

我已尝试使用钩子删除woocommerce-input-wrapper,但此跨度标记未在 checkfout 字段中删除。

我在我的活动主题中的functions.php中使用了以下脚本。

add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields)
 {
 unset($fields['billing']['billing_address_2']);
//echo "<pre>";print_r($fields);
  $fields['billing']['billing_email'] = array(
      'label'     => '',
      //'input_wrapper' =>'fdsf',
    'placeholder'   => _x('email', 'placeholder', 'woocommerce'),
    'input_class'  => array("form-control"),
    'class'     => array('form-group'),
    'priority'     => 4
     );
 //$fields['billing']['billing_email']['placeholder'] = 'Email Address ';
 $fields['billing']['billing_company']['placeholder'] = 'Business Name';
 $fields['billing']['billing_company']['label'] = 'Business Name';
 $fields['billing']['billing_first_name']['placeholder'] = 'First Name'; 
 $fields['shipping']['shipping_first_name']['placeholder'] = 'First Name';
 $fields['shipping']['shipping_last_name']['placeholder'] = 'Last Name';
 $fields['shipping']['shipping_company']['placeholder'] = 'Company Name'; 
 $fields['billing']['billing_last_name']['placeholder'] = 'Last Name';
 
 $fields['billing']['billing_phone']['placeholder'] = 'Phone ';
 return $fields;
 }

谁能帮我删除结帐表单字段中的跨度标签,我对 woocommerce 不太了解,所以请帮助我如何删除跨度标签。

【问题讨论】:

标签: php wordpress woocommerce hook-woocommerce


【解决方案1】:

通过将 WooCommerce 的默认结帐模板复制到您的主题文件夹来覆盖它。对新文件进行必要的删除。

【讨论】:

    猜你喜欢
    • 2014-08-09
    • 1970-01-01
    • 2021-06-22
    • 2021-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多