在移动设备上使用 WooCommerce 结账时将产品部分移至顶部
Move product section to top when on mobile on WooCommerce checkout
我正在尝试在 WooCommerce Checkout 移动设备上将产品部分移至顶部。我不希望帐单部分位于顶部。
我尝试了以下方法,但没有成功:
add_action('wp_footer', 'mobile_checkout');
function mobile_checkout() {
if ( wp_is_mobile() && is_checkout() ) {
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_before_checkout_billing_form', 'woocommerce_order_review', 1 );
}
}
关于如何移动它有什么想法吗?
这应该足够了:
function action_woocommerce_before_checkout_billing_form() {
// Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
if ( wp_is_mobile() ) {
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_before_checkout_billing_form', 'woocommerce_order_review', 5 );
}
}
add_action( 'woocommerce_before_checkout_billing_form', 'action_woocommerce_before_checkout_billing_form', 1 );
我正在尝试在 WooCommerce Checkout 移动设备上将产品部分移至顶部。我不希望帐单部分位于顶部。
我尝试了以下方法,但没有成功:
add_action('wp_footer', 'mobile_checkout');
function mobile_checkout() {
if ( wp_is_mobile() && is_checkout() ) {
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_before_checkout_billing_form', 'woocommerce_order_review', 1 );
}
}
关于如何移动它有什么想法吗?
这应该足够了:
function action_woocommerce_before_checkout_billing_form() {
// Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
if ( wp_is_mobile() ) {
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_before_checkout_billing_form', 'woocommerce_order_review', 5 );
}
}
add_action( 'woocommerce_before_checkout_billing_form', 'action_woocommerce_before_checkout_billing_form', 1 );