utils->is_step_post_type() ) {
// @codingStandardsIgnoreStart
?>
is_flow_testmode() ) { ?>
utils->get_flow_id();
}
$test_mode = wcf()->options->get_flow_meta_value( $flow_id, 'wcf-testing' );
if ( 'no' === $test_mode ) {
return false;
}
return true;
}
/**
* Get steps data.
*
* @since 1.0.0
* @param int $flow_id flow ID.
*
* @return array
*/
function get_steps( $flow_id ) {
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
if ( ! is_array( $steps ) ) {
$steps = array();
}
return $steps;
}
/**
* Check thank you page exists.
*
* @since 1.0.0
* @param array $order order data.
*
* @return bool
*/
function is_thankyou_page_exists( $order ) {
$thankyou_step_exist = false;
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
if ( $flow_id ) {
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
if ( is_array( $flow_steps ) ) {
$current_step_found = false;
foreach ( $flow_steps as $index => $data ) {
if ( $current_step_found ) {
if ( 'thankyou' === $data['type'] ) {
$thankyou_step_exist = true;
break;
}
} else {
if ( intval( $data['id'] ) === $step_id ) {
$current_step_found = true;
}
}
}
}
}
return $thankyou_step_exist;
}
/**
* Check thank you page exists.
*
* @since 1.0.0
* @param array $order order data.
*
* @return bool
*/
function get_thankyou_page_id( $order ) {
$thankyou_step_id = false;
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
if ( $flow_id ) {
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
if ( is_array( $flow_steps ) ) {
$current_step_found = false;
foreach ( $flow_steps as $index => $data ) {
if ( $current_step_found ) {
if ( 'thankyou' === $data['type'] ) {
$thankyou_step_id = intval( $data['id'] );
break;
}
} else {
if ( intval( $data['id'] ) === $step_id ) {
$current_step_found = true;
}
}
}
}
}
return $thankyou_step_id;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Flow_Frontend::get_instance();