Stuck with WooCommerece Payment Method Plugin (custom coded)


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.

, , Mueed Ullah 2 years 2020-01-10T08:39:12-05:00 0 Answers 71 views 0

Leave an answer