我想将WooCommerce订单状态从"已完成"重命名为"已收到订单".我可以编辑下面wc-order-functions.php中的脚本,但我不想修改任何核心文件或使用插件.
是否可以使用子主题functions.php文件中的脚本覆盖woocoomerce函数?
function wc_get_order_statuses() {
$order_statuses = array(
'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ),
'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
'wc-on-hold' => _x( 'On Hold', 'Order status', 'woocommerce' ),
'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ),
'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
'wc-refunded' => _x( 'Refunded', 'Order status', 'woocommerce' ),
'wc-failed' => _x( 'Failed', 'Order status', 'woocommerce' ),
);
return apply_filters( 'wc_order_statuses', $order_statuses );
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试检查优惠券是否仍然有效(尚未达到其使用限制)并在此条件下显示内容。
这样做的原因是我希望能够向特定访问者分发优惠券代码,但显然不想分发已经达到使用限制的优惠券。
我试图用 PHP 来实现这一点,并想象代码是这样的:
<?php if (coupon('mycouponcode') isvalid) {
echo "Coupon Valid"
} else {
echo "Coupon Usage Limit Reached"
} ?>
Run Code Online (Sandbox Code Playgroud)
这里的任何帮助都会很棒:)
我怎样才能交货添加右下方CAH自定义textarea的领域,所以当你的现金点击交货单选按钮,一个textarea出现输入得到保存到订单的详细信息?
我想在WooCommerce中创建具有相同SKU的多个简单产品.我在管理员设置中搜索,但在那里我找不到任何设置来启用此功能.有没有钩子所以我可以禁用此功能.
我已经使用这个优秀的教程将自定义字段添加到Woocommerce/Add Product/General选项卡http://www.remicorson.com/mastering-woocommerce-products-custom-fields/
自定义字段(高度,宽度,乘数)正在保存到数据库中.
我想根据自定义字段计算价格,并将价格作为常规价格保存到数据库中.问题是价格没有得到保存.
这是我的代码,来自我的子主题中的functions.php:
/* CUSTOM FIELDS: Add custom fields to Product/General pane in Woocommerce
from http://www.remicorson.com/mastering-woocommerce-products-custom-fields/ */
// Display Fields
add_action('woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields');
// Save Fields
add_action('woocommerce_process_product_meta', 'woo_add_custom_general_fields_save');
function woo_add_custom_general_fields()
{
global $woocommerce, $post;
echo '<div class="options_group">';
// Product Height
woocommerce_wp_text_input(
array(
'id' => '_product_height',
'label' => __('Product Height (inches)', 'woocommerce'),
'placeholder' => '',
'description' => __('Enter the product height in inches here.', 'woocommerce'),
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) …Run Code Online (Sandbox Code Playgroud) 我正在尝试申请autocomplete="off"我的WooCommerce结帐字段,但它不起作用.
结账表格有没有办法做到这一点?
我检查了文档,那里没有任何可用的东西.我也尝试将默认值设置为空,但它也不起作用.这是用户当然没有登录的时间.
更新:
我unset按照@smvax的建议尝试过,但它没有用.
add_filter('woocommerce_checkout_fields', 'default_values_checkout_fields');
function default_values_checkout_fields($fields) {
if (!is_user_logged_in()) {
unset($fields['billing_city']);
unset($fields['billing_first_name']);
unset($fields['billing_last_name']);
unset($fields['billing_company']);
unset($fields['billing_address_1']);
unset($fields['billing_address_2']);
unset($fields['billing_city']);
unset($fields['billing_postcode']);
unset($fields['billing_country']);
unset($fields['billing_state']);
unset($fields['billing_email']);
unset($fields['billing_phone']);
unset($fields['shipping_city']);
unset($fields['shipping_first_name']);
unset($fields['shipping_last_name']);
unset($fields['shipping_company']);
unset($fields['shipping_address_1']);
unset($fields['shipping_address_2']);
unset($fields['shipping_postcode']);
unset($fields['shipping_country']);
unset($fields['shipping_state']);
return $fields;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在尝试更改WooCommerce Registration表单的最小密码强度,我无法做多少.
任何人都可以分享一个解决方案,通过该解决方案,我可以修改最小密码强度,并允许用户使用长度为7个字符且内部不需要任何符号或大写字母的密码?
谢谢.
我想使用wordpress在我的网站上添加变体。
我尝试了很多插件,但是它们不能按照我的要求工作。
要求:
我想根据给定的价格变动价格:
1) Colors
2) Lining
3) Sizes
4) Leather Type
Run Code Online (Sandbox Code Playgroud)

任何人都可以引用插件或功能吗?
当用户在我的 woocommerce 商店结帐时,如果他们选择某个支付网关,例如“paypal_pro”、“check”、“bacs”或在我的情况下是“wdc_woo_credits”,我想将税设置为 0。这是一个 woocredits 插件,允许用户使用信用而不是信用卡付款。
我知道这个函数正确地设置了税,因为当我 print_r($cart_object) 我看到我将所有的税设置为 0,但结帐仍然应用了总数中的税。
我想我需要一个在使用下面的函数设置后重新计算税收的函数。
add_action( 'woocommerce_cart_calculate_fees','shipping_method_discount', 20, 1 );
function shipping_method_discount( $cart_object ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
$chosen_payment_method = WC()->session->get('chosen_payment_method');
//if( $chosen_payment_method == 'cheque' ){
if( $chosen_payment_method == 'wdc_woo_credits' ){
$cart_object->set_cart_contents_taxes(0);
$cart_object->set_cart_contents_tax(0);
$cart_object->set_subtotal_tax(0);
$cart_object->set_shipping_tax(0);
$cart_object->set_total_tax(0);
$cart_object->set_fee_tax(0);
$cart_object->set_fee_taxes(0);
$cart_object->set_subtotal_tax(0);
foreach($cart_object->cart_contents as $product){
$cart_object->cart_contents[$product['key']]['line_tax'] = 0;
$cart_object->cart_contents[$product['key']]['line_subtotal_tax'] = 0;
$cart_object->cart_contents[$product['key']]['line_tax_data']['subtotal'] = 0;
$cart_object->cart_contents[$product['key']]['line_tax_data']['total'] = 0;
}
}
//echo '<pre>'; print_r($cart_object); echo '</pre>';
}
Run Code Online (Sandbox Code Playgroud)
此功能检测他们选择的付款选择并重新运行更新结帐功能。但税收仍然在总数中。
add_action( 'woocommerce_review_order_before_payment', 'refresh_payment_methods' ); …Run Code Online (Sandbox Code Playgroud)