woocommerce offtopic – Need to check if user has completed a woo commerce payment

Question

I am newbie at php.

I am trying to check if user has a payment token or some other value that confirms they have made payment.

I want to redirect the page if the payment status is empty 9they have not made payment yet).

I tried :

<?php  

 if(get_post_type()=="sfwd-lessons"){
     $lesson_id=get_the_ID();
 }else{
     $lesson_id=get_post_meta(get_the_ID(),'lesson_id',true);
 }

  $value = get_field( "new_field", $lesson_id );
   $user_status=get_wpmg_woocommerce_payment_tokens($user_id,'token_id',true);
   //$user_status="";
if(!empty($value) && empty($user_status)){
    header('Location: https://xx/checkouts/checkout-page/');
    exit;
    ?>

but I dot think “get_wpmg_woocommerce_payment_tokens” is a valid call

is there another get_ call I can make to check if payment token_id is empty?

or is there a way on the woo commerce thank you page to write new field “payment_status” complete to user_meta_data

thanks

0
fuxia 4 months 2022-04-14T12:18:08-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse