Ad
Move Product Section To Top When On Mobile On WooCommerce Checkout
I'm trying to move the product section to the top when on mobile on WooCommerce Checkout. I do not want the the billing section to be on top.
I tried with the following, without success:
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 );
}
}
Any ideas on how to move it?
Ad
Answer
This should suffice:
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 );
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad