AI Verified

Name

Confirm Order Button | WooCommerce My Account

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

jbeer

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

14/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Confirm Order Button | WooCommerce My Account

 
                    
1add_filter( 'woocommerce_my_account_my_orders_actions', 'bbloomer_confirm_order_my_account_orders_actions', 9999, 2 );
2 
3function bbloomer_confirm_order_my_account_orders_actions( $actions, $order ) {
4 if ( $order->has_status( 'processing' ) ) {
5 $actions['confirm-order'] = array(
6 'url' => wp_nonce_url( add_query_arg( array( 'confirm_order' => $order->get_id() ) ), 'woocommerce-confirm-order' ),
7 'name' => __( 'Confirm Order', 'woocommerce' )
8 );
9 }
10 return $actions;
11}
12 
13add_action( 'template_redirect', 'bbloomer_on_confirm_order_click_complete_order' );
14 
15function bbloomer_on_confirm_order_click_complete_order( $order_id ) {
16 if ( isset( $_GET['confirm_order'], $_GET['_wpnonce'] ) && is_user_logged_in() && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'woocommerce-confirm-order' ) ) {
17 $order = wc_get_order( $_GET['confirm_order'] );
18 $order->update_status( 'completed', 'Order confirmed by customer' );
19 }
20}

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

German Market - Doppelter Preis + Lieferzeit

Added: 11 months ago

Last Updated: 1 month ago

ASTRA Theme und German Market Darstellungsproblem

WooCommerce

AI Verified

0

Show 'NEW' Badges for Recently Added Items in WooCommerce

Added: 4 months ago

Last Updated: 4 months ago

This code snippet adds a "NEW!" badge to products in WooCommerce, indicating that they are newly added. The badge is displayed both on the product archive pages and the single product template for a s...

WooCommerce

AI Verified

0

WooCommerce Show Custom Text On Empty Cart Page

Added: 1 year ago

Last Updated: 1 year ago

If the user navigates to the cart page when there is nothing in their cart, they will see a cart notification, “Your cart is currently empty.” To change that particular cart notification, check out ou...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

2

Confirm Password Field in Woocommerce

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

2

Add Product Picture to Orderlist

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

2

Redirect customers to own thank-you page after order

Added: 1 year ago

Last Updated: 1 year ago

You may want to redirect your customers to a custom thank you page after they place an order. You can do that with the following WooCommerce snippet