【发布时间】:2016-03-11 19:18:00
【问题描述】:
如果购物车是免费的,我想在 Woocommerce 结帐中隐藏账单详细信息,所以我试图在主题 functions.php 中获取购物车价格,但出现此错误:
Call to a member function get_cart_total() on a non-object
我尝试使用的代码是:
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
global $woocommerce;
if ( $woocommerce->cart->get_cart_total() == 0 ) {
function kia_filter_billing_fields($fields){
unset( $fields["billing_email"] );
unset( $fields["billing_last_name"] );
unset( $fields["billing_first_name"] );
unset( $fields["billing_country"] );
unset( $fields["billing_company"] );
unset( $fields["billing_address_1"] );
unset( $fields["billing_address_2"] );
unset( $fields["billing_city"] );
unset( $fields["billing_state"] );
unset( $fields["billing_postcode"] );
unset( $fields["billing_phone"] );
return $fields;
}
}
我在互联网的帮助下通过了这里,但我被困住了。如果您能帮助我,我将不胜感激。
【问题讨论】:
标签: php wordpress woocommerce