Woocommerce Advance Checkout
Beta Version Alert! Experiencing issues? Reach out for support. Have feature requests? Let us know. We're committed to quick updates. Thank you for your feedback and understanding! Contact Us here
Found this plugin useful? Please leave us a review here. This will help motivate us to add new features in the future Rate us Here
Upload LogoThis logo will appear only on checkout page
' height='50'>
'>
'>Logo Width (px)
Policies LinkAdd Policy Pages Name and link, they'll appear in footer of checkout page (e.g privacy policy, terms and conditions).
$WAWC_page_name) { $WAWC_page_link = isset($WAWC_page_links[$index]) ? $WAWC_page_links[$index] : ''; ?>
Google Map API KeyAdd Google MAP API key to access "Address Autocomplete Feature".
Remove Additional FieldsRemove Unnecessary/Unwanter features from default woocommerce checkout page..
Order BumpGet Extra Sales by using order bump feature, sell product, insurance, offer using order bump.
Order Bump Title
Price of Order Bump
Bump Description
Order Bump Image
' height='100'>
'>
CustomizeCustomize colors and style of your checkout page
Button Background Color
Button Text Colors
Link Colors
:root { --btn-back-color: ' . $btnclr . '; --btn-text-color: ' . $btntxtclr . '; --link-colors: ' . $lnkclr . '; --logo-width-px:'.$logowid.'px; }'; } } add_action( 'wp_head', 'WAWC_custom_checkout_css' ); add_action( 'admin_footer', 'WAWC_media_selector_print_scripts' ); function WAWC_media_selector_print_scripts() { $my_saved_attachment_post_id = get_option( 'WAWC_logo_selector', 0 ); $my_saved_bump_attachment_post_id = get_option( 'WAWC_bump_image_selector', 0 ); ?> '; } // Custom function to output the opening div tag before the checkout form add_action( 'woocommerce_before_checkout_form', 'WAWC_WAWC_start_custom_div_before_checkout', 5 ); function WAWC_WAWC_start_custom_div_before_checkout() { echo '
'; if ($attachment_url = wp_get_attachment_url(get_option('WAWC_logo_selector'))) { echo ''; } echo '
Home > Login > Details > Payment
Home > Login > Details> Payment
Home > Login > Details> Payment
'; // Get WooCommerce settings $allow_orders_without_account = ('yes' === get_option( 'woocommerce_enable_guest_checkout' )) ? true : false; $allow_login_during_checkout = ('yes' === get_option( 'woocommerce_enable_checkout_login_reminder' )) ? true : false; $allow_account_creation_during_checkout = ('yes' === get_option( 'woocommerce_enable_signup_and_login_from_checkout' )) ? true : false; if (!is_user_logged_in() && !$allow_orders_without_account && $allow_login_during_checkout && $allow_account_creation_during_checkout) { echo do_shortcode('[woocommerce_my_account]'); } if (is_plugin_active('login-with-phone-number/login-with-phonenumber.php')) { echo '
' . do_shortcode('[idehweb_lwp]') . '
'; } } function WAWC_start_custom_div() { $WAWC_page_names = get_option('WAWC_page_names', array()); $WAWC_page_links = get_option('WAWC_page_links', array()); if (!empty($WAWC_page_names)) { echo ''; } echo '
'; } // Custom function to output the closing div tag function WAWC_end_custom_div() { // Get the Order Bump Position value $orderBumpPosition = get_option('WAWC_order_bump_position'); // Output different things based on the Order Bump Position if ($orderBumpPosition === 'below_summary') { echo do_shortcode('[WAWC_order_bump]'); } echo '
Order Summary
'; if ($attachment_url = wp_get_attachment_url(get_option('WAWC_logo_selector'))) { echo ' '; } } // Add the opening div tag before the order review add_action( 'woocommerce_after_checkout_form', 'WAWC_start_custom_div', 15 ); // Add the order review after the checkout form add_action( 'woocommerce_after_checkout_form', 'woocommerce_order_review', 20 ); // Add the coupon form after the order review if (get_option('WAWC_remove_coupons') != 1) { add_action( 'woocommerce_after_checkout_form', 'woocommerce_checkout_coupon_form', 30 ); } // Add the closing div tag after the coupon form add_action( 'woocommerce_after_checkout_form', 'WAWC_end_custom_div', 35 ); // Edit Order Summary add_filter( 'woocommerce_cart_item_name', 'WAWC_add_product_image_and_remove_link_to_order_review', 10, 3 ); function WAWC_add_product_image_and_remove_link_to_order_review( $name, $cart_item, $cart_item_key ) { $thumbnail = $cart_item['data']->get_image(); $quantity = sprintf('%d', $cart_item['quantity']); $remove_link = sprintf( '×', esc_url( wc_get_cart_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ) ); // Get the product variation $variation = ''; if (!empty($cart_item['variation'])) { foreach ($cart_item['variation'] as $attribute => $term_slug) { $taxonomy = str_replace('attribute_', '', $attribute); $term = get_term_by('slug', $term_slug, $taxonomy); $variation .= ' ' . $term->name; } } // Limit the product name to 40 characters if (strlen($name) > 40) { $name = substr($name, 0, 40) . '...'; } // Append the variation to the product name $name .= $variation; return $thumbnail . ' ' . $name . ' ' . $quantity . ' ' . $remove_link; } // ADD share button in Thanks Page add_action( 'woocommerce_thankyou', 'WAWC_thankyou_share_buttons', 10, 1 ); function WAWC_thankyou_share_buttons( $order_id ) { if ( ! $order_id ) return; $order = wc_get_order( $order_id ); $order_url = $order->get_view_order_url(); $whatsapp_url = 'https://api.whatsapp.com/send?text=' . urlencode( 'I have just purchased: ' . $order_url ); $facebook_url = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode( $order_url ); $twitter_url = 'https://twitter.com/intent/tweet?url=' . urlencode( $order_url ) . '&text=' . urlencode( 'Check out my recent purchase!' ); $print_url = 'javascript:window.print()'; echo '

Share Your Order:

'; echo 'Share on WhatsApp'; echo 'Share on Facebook'; echo 'Share on Twitter'; echo 'Print'; echo '
'; } // Make Shipping Fields Options add_filter( 'woocommerce_checkout_fields', 'WAWC_make_shipping_address_fields_required' ); function WAWC_make_shipping_address_fields_required( $fields ) { $fields['shipping']['shipping_first_name']['required'] = false; $fields['shipping']['shipping_last_name']['required'] = false; $fields['shipping']['shipping_company']['required'] = false; $fields['shipping']['shipping_country']['required'] = false; $fields['shipping']['shipping_address_1']['required'] = false; $fields['shipping']['shipping_address_2']['required'] = false; $fields['shipping']['shipping_city']['required'] = false; $fields['shipping']['shipping_state']['required'] = false; $fields['shipping']['shipping_postcode']['required'] = false; return $fields; } // Change the apply coupon button text on the cart and checkout page function WAWC_woocommerce_button_text ($translation, $text, $domain) { if ($domain == 'woocommerce' && $text == 'Apply coupon') { return 'Apply'; // Replace 'Your New Button Text' with the desired text. } return $translation; } add_filter ('gettext', 'WAWC_woocommerce_button_text', 10, 3); // Add placeholder in all fields // Assign all labels as placeholders in WooCommerce checkout fields function WAWC_labels_inside_checkout_fields ($fields) { foreach ($fields as $section => $section_fields) { foreach ($section_fields as $section_field => $section_field_settings) { $fields[$section] [$section_field] ['placeholder'] = $fields[$section] [$section_field] ['label']; $fields[$section] [$section_field] ['label'] = ''; } } return $fields; } add_filter ('woocommerce_checkout_fields', 'WAWC_labels_inside_checkout_fields'); // Handle Logout request function WAWC_handle_inline_ajax_logout() { check_ajax_referer('inline_logout_nonce', 'nonce'); if (isset(WC()->session->cart)) { $cart = WC()->session->cart; } wp_logout(); if (isset($cart)) { WC()->session->cart = $cart; } wp_send_json_success(); } add_action('wp_ajax_inline_ajax_logout', 'WAWC_handle_inline_ajax_logout'); add_action('wp_ajax_nopriv_inline_ajax_logout', 'WAWC_handle_inline_ajax_logout'); add_action( 'wp_enqueue_scripts', 'WAWC_enqueue_checkout_css' ); function WAWC_enqueue_checkout_css() { $rand = rand(1, 9999); if ( is_checkout() || is_order_received_page() ) { wp_enqueue_style( 'checkout-css', plugins_url( '/assets/css/checkout-css.css', __FILE__ ) , array(), $rand, false); } } add_action('wp_head', 'WAWC_add_checkout_inline_styles'); add_action('wp_enqueue_scripts', 'WAWC_enqueue_checkout_scripts'); function WAWC_enqueue_checkout_scripts() { $rand = rand(1, 9999); if (is_checkout()) { // Enqueue Google Maps script without version parameter if ($WAWC_KEY = get_option('WAWC_map_api')) { wp_enqueue_script('google-map-scripts', '//maps.googleapis.com/maps/api/js?key='.$WAWC_KEY.'&libraries=places&callback=initAutocomplete', array(), null, false); // Enqueue other scripts without version parameter wp_enqueue_script('address-autocomplete', plugins_url('/assets/js/address-autocomplete.js', __FILE__), array(), null, true); } wp_enqueue_script('checkout-scripts', plugins_url('/assets/js/checkout-scripts.js', __FILE__), array('jquery'), $rand, true); // Localize the checkout-scripts script wp_localize_script('checkout-scripts', 'myAjax', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('inline_logout_nonce') )); // Filter to add defer attribute to google-map-scripts add_filter('script_loader_tag', 'WAWC_add_defer_attribute', 10, 2); } } function WAWC_add_defer_attribute($tag, $handle) { // Add defer attribute to the specific script handle if ('google-map-scripts' === $handle) { $tag = str_replace(' src', ' defer="defer" src', $tag); } return $tag; } function WAWC_add_checkout_inline_styles() { if ( is_checkout() ) { $styles = ''; $allow_guest_checkout = get_option('woocommerce_enable_guest_checkout'); if ( is_user_logged_in() || $allow_guest_checkout === 'yes') { $styles .= ' div#order_review{ display:none; } .multis-step.step1{ display:none; } .multis-step.step3,.back-step3{ display:none; }'; } else { $styles .= ' .multis-step.step2,.multis-step.step3{ display:none; } form.checkout.woocommerce-checkout{ display:none!important; }'; } if( $allow_guest_checkout === 'yes'){ $styles .= ' button.back-step2 { pointer-events: none; opacity: 0; }'; } echo ''; } else { echo ' '; } } add_filter( 'page_template', 'WAWC_page_template' ); function WAWC_page_template( $page_template ) { if ( is_checkout() ) { $page_template = dirname( __FILE__ ) . '/includes/custom-checkout-template.php'; } return $page_template; } function WAWC_remove_additional_fields($fields) { // You can unset other specific fields if needed if (get_option('WAWC_remove_company') == 1) { unset($fields['billing']['billing_company']); } if (get_option('WAWC_remove_address2') == 1) { unset($fields['billing']['billing_address_2']); } if (get_option('WAWC_remove_phone') == 1) { unset($fields['billing']['billing_phone']); } return $fields; } add_filter('woocommerce_checkout_fields', 'WAWC_remove_additional_fields'); // Remove order notes function WAWC_remove_order_notes($fields) { if (get_option('WAWC_remove_additional_field') == 1) { unset($fields['order']['order_comments']); } return $fields; } add_filter('woocommerce_checkout_fields', 'WAWC_remove_order_notes'); add_action('woocommerce_before_checkout_form', 'WAWC_remove_checkout_login_form', 4); function WAWC_remove_checkout_login_form() { remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10); } } ////////////////////// // Display the checkbox - Step 1 function WAWC_content_above_checkout_review_order() { // Get the Order Bump Position value $orderBumpPosition = get_option('WAWC_order_bump_position'); // Output different things based on the Order Bump Position if ($orderBumpPosition === 'above_payment') { echo do_shortcode('[WAWC_order_bump]'); } } add_action('woocommerce_review_order_before_payment', 'WAWC_content_above_checkout_review_order'); function one_time_offer_shortcode() { $orderBumpTitle = get_option('WAWC_order_bump_title'); $orderBumpDescription = get_option('WAWC_order_bump_description'); $bumpImageAttachmentId = get_option('WAWC_bump_image_selector'); ob_start(); echo '
'; woocommerce_form_field('one_time_offer', array( 'type' => 'checkbox', 'class' => array('input-checkbox'), 'label' => $orderBumpTitle, ), WC()->checkout->get_value('one_time_offer')); echo '
'.$orderBumpDescription.'
'; echo '
'; return ob_get_clean(); } add_shortcode('WAWC_order_bump', 'one_time_offer_shortcode'); // Add the new field to order totals - Step 3 add_action('woocommerce_cart_calculate_fees', 'add_one_time_offer_fee'); function add_one_time_offer_fee() { $orderBumpPrice = get_option('WAWC_order_bump_price'); if ( !WC()->cart->is_empty() && WC()->session->__isset('one_time_offer') ) { WC()->cart->add_fee('One Time Offer', $orderBumpPrice); } } // Update the session value when the checkbox is clicked - Step 4 // Update the session value when the checkbox is clicked - Step 4 add_action('wp_ajax_one_time_offer', 'update_one_time_offer_session'); add_action('wp_ajax_nopriv_one_time_offer', 'update_one_time_offer_session'); function update_one_time_offer_session() { if(isset($_POST['one_time_offer'])) { if($_POST['one_time_offer']) { WC()->session->set('one_time_offer', $_POST['one_time_offer']); } else { WC()->session->__unset('one_time_offer'); } } echo json_encode( WC()->session->__isset('one_time_offer') ); }