Search
 
SCRIPT & CODE EXAMPLE
 

PHP

auto complete order paid

add_action( 'woocommerce_payment_complete_order_status', 'wc_auto_complete_paid_order', 10, 3 );
function wc_auto_complete_paid_order( $status, $order_id, $order ) {
    return 'completed';
}
Comment

auto complete order paid1

add_action( 'woocommerce_thankyou', 'wc_auto_complete_paid_order', 20, 1 );
function wc_auto_complete_paid_order( $order_id ) {
    if ( ! $order_id )
        return;
    
    // Get an instance of the WC_Product object
    $order = wc_get_order( $order_id );
    
    // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
    if ( in_array( $order->get_payment_method(), array( 'bacs', 'cod', 'cheque', '' ) ) ) {
        return;
    } 
    // For paid Orders with all others payment methods (paid order status "processing")
    elseif( $order->has_status('processing') ) {
        $order->update_status( 'completed' );
    }
}
Comment

auto complete order paid2

/**
 * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE
 */
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_paid_order', 10, 1 );
function custom_woocommerce_auto_complete_paid_order( $order_id ) {
    if ( ! $order_id )
    return;

    $order = wc_get_order( $order_id );

    // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
    if ( ( 'bacs' == get_post_meta($order_id, '_payment_method', true) ) || ( 'cod' == get_post_meta($order_id, '_payment_method', true) ) || ( 'cheque' == get_post_meta($order_id, '_payment_method', true) ) ) {
        return;
    } 
    // For paid Orders with all others payment methods (with paid status "processing")
    elseif( $order->get_status()  === 'processing' ) {
        $order->update_status( 'completed' );
    }
}
Comment

auto complete order paid3

add_action( 'woocommerce_payment_complete', 'wc_auto_complete_paid_order', 20, 1 );
function wc_auto_complete_paid_order( $order_id ) {
    if ( ! $order_id )
        return;

    // Get an instance of the WC_Product object
    $order = wc_get_order( $order_id );

    // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
    if ( in_array( $order->get_payment_method(), array( 'bacs', 'cod', 'cheque', '' ) ) ) {
        return;
    // Updated status to "completed" for paid Orders with all others payment methods
    } else {
        $order->update_status( 'completed' );
    }
}
Comment

auto complete order paid1

add_filter('woocommerce_order_item_needs_processing', '__return_false',999);
Comment

PREVIOUS NEXT
Code Example
Php :: get cpanel username php 
Php :: how to remove payment link in invoice woocommerce 
Php :: call stored procedure in laravel 
Php :: implement class in autoloader athow to implment data table in laravel project 
Php :: .htaccess Preventing access to your PHP includes files 
Php :: phpdoc array of strings 
Php :: $n = readline(); for($i = 0; $i < $n ; $i++) { $name = readline(); $names[$name] = (isset($names[$name]) ? $names[$name] + 1 : 1); } 
Php :: php import 
Php :: Round A Number 
Php :: Akkhor - School Management Admin Template download 
Php :: The app function returns the service container instancel 
Php :: cache.backend.null 
Php :: How can apply_filters be used to create a filter hook in wordpress 
Php :: custom-taxonomy-image-option-in-admin-panel 
Php :: connecting to database and performing sql queries 
Php :: $order- date 
Php :: onde que fica a praia escondida no roblox jo mulher maravilha 
Php :: bitnami wp user pass change 
Php :: symfony dump request headers 
Php :: sail laravel mix hot 
Php :: htaccess file for multisite 
Php :: Removing the additional information tab using PHP code snippet 
Php :: storefront header cart 
Php :: php wxplode 
Php :: How To Substract And Add Hours In Laravel Using Carabon? 
Php :: array length php for loop 
Php :: php square root 
Php :: search highlighting 
Php :: wp_query not have term 
Php :: Laravel 9.x Terminal can not migrate table 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =