WooCommerce - excelling eCommerce
[resolved] Pass Order Variable Post Submit (3 posts)

  1. NDabaz
    Posted 2 years ago #

    I'm attempting to make a page that comes up instead of order details, featuring a specific plugin I've created that puts information up based on the order.

    My issue is as follows:

    Based on everything I've seen, the cart is emptied after payment processing, however I'd like to hook into the Order (as order details itself does), and use the array from get_items, to get the product ID purchased, and suggest another product ID based on that.

    My issue is that when using it in a plugin, outside of woocommerce itself, I seem to be completely unable to access the order.

    So basically: does anyone know how to access the Order information outside of the Woocommerce loop?


  2. samueljeden
    Posted 2 years ago #

    global $post;
        $order = new WC_Order( $post->ID );

    Although i am using WooCommerce Beta :)

  3. NDabaz
    Posted 2 years ago #

    Awesome Samuel, super simple but for some reason I just couldn't figure it out.

    That worked like a charm (if this were Stackoverflow I'd give you a huge upvote).

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic