0

I am development a plugin for custom payment method for WOoCommerce, where in "public function result()" function I want to access/get product id which is bought. Below is my code so far but it is not working;

 public function result() {
        global $woocommerce,$wp;
   $order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order- 
       received'] ) );
    $orderr = wc_get_order( $order_id );
   $itemss = $orderr->get_items();
   foreach($itemss as $itemm){
    $product_id = $item->get_product_id();
     $authenticationcode =  get_post_meta($product_id, 'authenticationcode', true );
     $merchantcode = get_post_meta($product_id, 'merchantcode', true );
    }}

Any help would be very helpful.

1 Answers1

0

I think Inside your foreach loop using a wrong variable. wrong variable : $item->get_product_id();

Correct varible itemm->get_product_id();