• Resolved europeart

    (@europeart)


    Hi,

    What is the way to display the complete array of all the custom fields that we added with your plugin?

    For example, to display an array of all WooCommerce product fields, we do it like this:

    print_r($product);

    And array variants:
    print_r($product->get_variation_prices());

    How would it be to display the fields that we added with the plugin?

    Kind regards !

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support dominikl65

    (@dominikl65)

    Hi,

    It all depends on whether you want to know this before the order is placed or already after.

    Before the order is placed, the settings template is dynamically assigned to the product on the basis of the relevant queries (this is not rigidly assigned in the database). The assignment itself can be seen in the admin panel (where we set the assignment to product / category etc.).

    After the order has been placed, each ‘product item’ should have this in the meta data, so you only need this code to see all the fields added to the product in the order:

    $order_id = 78;
    $order = wc_get_order( $order_id );

    $items = $order->get_items();
    foreach ( $items as $item ) {
        $meta_data = $item->get_all_formatted_meta_data();
        print_r( $meta_data );
    }

    Plugin Support dominikl65

    (@dominikl65)

    Hi,

    I haven’t heard from you in a while, so I’m marking this thread as resolved. Please don’t hesitate to open a new one if you encounter other issues while using our plugin.

    Have a fantastic day,

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.