[WooCommerce] 注文のステータスによって処理を分岐する
この記事は、過去の記事や制作物を移動したものです。
記事の内容が古い可能性がございますのでご注意ください。
WooCommerce 注文のステータスによって処理を分岐します。
サンプルコード
<?php
// 注文情報の取得
$order = wc_get_order( 注文ID );
// 注文のステータスによって処理を分岐する
if ( $order->has_status( ステータス ) ) {
// 処理記述
}
<?php
has_status()
使用例
<?php
// 注文情報の取得
$order = wc_get_order( 1 );
// 注文のステータスによって処理を分岐する
if ( $order->has_status( 'wc-pendding' ) ) {
// 処理記述
}