Uncaught Error: Call to a member function save() on bool
-
PHP Fatal error: Uncaught Error: Call to a member function save() on bool in /home/wp_site_1627320122/wp-content/plugins/wpc-force-sells/wpc-force-sells.php:792
function new_order_item( $item_id, $item, $order_id ) { $order = wc_get_order( $order_id ); $quantity = $item->get_quantity(); if ( ( 'line_item' === $item->get_type() ) && ! wc_get_order_item_meta( $item_id, '_woofs_ids', true ) && ! wc_get_order_item_meta( $item_id, '_woofs_parent_id', true ) ) { $product = $item->get_product(); $product_id = $product->get_id(); if ( $product && ( $woofs_ids = get_post_meta( $product_id, 'woofs_ids', true ) ) ) { if ( $woofs_items = self::get_items( $woofs_ids, $product_id ) ) { foreach ( $woofs_items as $woofs_item ) { $woofs_item_id = $woofs_item['id']; $woofs_item_price = $woofs_item['price']; $woofs_item_qty = $woofs_item['qty']; $woofs_item_product = wc_get_product( $woofs_item_id ); if ( ! $woofs_item_product ) { continue; } if ( get_post_meta( $product_id, 'woofs_separately', true ) !== 'on' ) { $woofs_product_price = $woofs_item_product->get_price(); $woofs_item_new_price = self::new_price( $woofs_product_price, $woofs_item_price ); $woofs_item_product->set_price( $woofs_item_new_price ); } // add force sells products $woofs_order_item_id = $order->add_product( $woofs_item_product, $woofs_item_qty * $quantity ); if ( ! $woofs_order_item_id ) { continue; } $woofs_order_items = $order->get_items( 'line_item' ); $woofs_order_item = $woofs_order_items[ $woofs_order_item_id ]; if ( get_post_meta( $product_id, 'woofs_separately', true ) !== 'on' ) { $woofs_order_item->add_meta_data( '_woofs_parent_id', $product_id, true ); } $woofs_order_item->save(); } } } $order->save(); } }
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Uncaught Error: Call to a member function save() on bool’ is closed to new replies.