Created
December 20, 2023 15:17
-
-
Save diogenesjup/152ef5e51f6e1e02f4ee2f2c1fa78318 to your computer and use it in GitHub Desktop.
Mudar status para processando automáticamente na confirmação do pagamento
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_payment_complete', 'custom_woocommerce_auto_complete_order' ); | |
function custom_woocommerce_auto_complete_order( $order_id ) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_id ); | |
// Verifique se o pedido é para produtos digitais | |
if ( $order->has_downloadable_item() && $order->has_status( 'completed' ) ) { | |
$order->update_status( 'processing' ); // Alterar o status para 'Processando' | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment