0

Intro: My company offers products as well as services, and we currently use Woocommerce to sell both. I would like to keep products separate from our services, as we treat our products similar to food orders at a restaurant with a timer in a queue. Currently we monitor our incoming orders during business hours and start working on our product creation as soon as an order with it comes in.

I have creates a submenu in Woocommerce Entitled "Products" and hooked it to a callback function "product_page" to render the admin page. This is where I am stuck. I need to access all of the Woocommerce orders that fall under the category "Product" and display them here, essentially as a clone of the default Woocommerce order admin area, but with a few mods.

I am using Gravity Forms Product Add ons for Woocommerce which is where all my Product data lies.

Question: How do I access the variables, or make use of the functions in other plugin class files? I need to make a custom database table that combines the gravity form entry data with custom data that I can then display on my admin area "product_page" as a queue of currently active orders needing to be created.

I don't understand the scope of the variables in other plugins, as I look through plugin file templates to emulate them, but they use variables that aren't defined in the file. The only explanation I can think of is that somewhere in their files they have used a hook or something to call their template files, and have passed variables that way.

Any help is appreciated,

Thanks!

-1

This is the answer to the main question. You cannot access other plugin's variables. If they're programmed using Object Oriented Programming pattern, then maybe you will be able to access a few public variables. But it is not the standard WordPress way.

The best way to do it is by using actions and filters.

If you want to show products that match a certain condition, I suggest you create new admin menu page, then use WPDB to do custom SQL query there.

And if you don't know how the WooCommerce and Gravity Forms data is structured, just browse the database using phpmyadmin or something that you're familiar with, and see the structure there.

I hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.