0
votes

I am working on WordPress Woo-Commerce Plugin Customization.

I added products as Included Products on Admin Page like Bellow Image.

enter image description here

I want to get all included product id from the Parent Product id. Please let me know if anyone have solution for this.

Regards

1

1 Answers

0
votes

Nice to meet you.

To resolve your issue, please add below code to plugins/woocommerce-ultimate-giftcard-function.

foreach ($include_product_new_array as $product_id){
                $product = wc_get_product( $product_id );
                $order->add_product($product, 1);
                //woocommerce_add_order_item($order_id, $product);
            }
            //$order->calculate_totals();
            $order->save(); // Save and sync the data