我找不到一种简单的方法来隐藏一些在 WordPress 后端的用户配置文件中可见的 WooCommerce 计费和运输字段。
例如,我想隐藏billing_address_2和shipping_address_2WordPress 用户配置文件。有没有用代码片段来做到这一点的好方法?我尝试使用下面的代码在 css 中隐藏第六行,但我也无法让它工作。
#fieldset-billing.form-table tr:nth-child(6) {
display: none;
}
Run Code Online (Sandbox Code Playgroud)
如何在 WordPress 用户个人资料中隐藏 WooCommerce 计费和运输字段?
我无法将产品属性添加到 WooCommerce 新订单电子邮件中。我已将下面的代码片段添加到 email-order-items.php (在 // SKU.. 部分之后),但没有任何反应。甚至标题“位置:”也不可见。对此有什么想法吗?
// Attribute
if ( $item_meta->meta ) {echo '<br/><small>Location: ' . nl2br( $product->get_attribute( 'location' ) ) . '</small>';}
Run Code Online (Sandbox Code Playgroud) php wordpress email-notifications custom-taxonomy woocommerce
我正在寻找一种€0,00用文本替换WooCommerce(版本 3.3.x)产品价格的方法,例如“基于合同”。最好在网上商店和电子邮件中可见。由于 WooCommerce 最近的变化,现有的片段不再起作用,例如:
add_filter('woocommerce_get_price_html', 'changeFreePriceNotice', 10, 2);
function changeFreePriceNotice($price, $product) {
if ( $price == wc_price( 0.00 ) )
return 'FREE';
else
return $price;
}
Run Code Online (Sandbox Code Playgroud)
或者
<?php
// Do not copy the opening <?php tag above
// Customize the Free! price output
add_filter( 'woocommerce_variable_free_price_html','wsm_custom_free_price' );
add_filter( 'woocommerce_free_price_html', 'wsm_custom_free_price' );
add_filter( 'woocommerce_variation_free_price_html', 'wsm_custom_free_price' );
function wsm_custom_free_price( $price ) {
// Edit content between single quotes below to desired output
return 'Prepaid Inventory';
}
Run Code Online (Sandbox Code Playgroud)
或者
function my_wc_custom_get_price_html( $price, $product …Run Code Online (Sandbox Code Playgroud)