I'm writing a plugin to customize the way Easy Digital Downloads behaves in the process of selling products. I want to let the customer buy a bundle included product as a physical product (using EDD-Simple-Shipping) and not the bundles.
So I'm using EDD-Simple-Shipping to be able to sell physical products but the problem is those physical items(books) have bundles(.pdf version of chapters of books) that users should pay to be able to download them.
The problem is when the user buys the bundle included product(book), after paying all the bundled downloads/products(digital chapters of the book) will be added to the receipt.
So I want to use hooks and/or other methods in my plugin so when a user buys a shipping enabled download/product, EDD doesn't add the bundled items to the receipt and user purchase history.
note: I can't migrate to other E-commerce solutions like Woo-Commerce anything for now because there are lots of items added already.
So far I found these functions in the EDD source code that may help with the solution :
in includes/download-functions.php
edd_get_download_type($download_id) // Gets the Download type, either default or "bundled"
edd_is_bundled_product( $download_id = 0 ) // Determines if a product is a bundle
edd_get_bundled_products() // Retrieves the product IDs of bundled products
in includes/payments/actions.php
edd_complete_purchase() //Performs all necessary actions to complete a purchase. Triggered by the edd_update_payment_status() function.
Also this hook in actions.php
do_action( 'edd_complete_download_purchase', $download['id'], $payment_id, $download_type, $download, $cart_index );
But it is an action hook and I can't modify anything using this.
So far I couldn't find where EDD is storing the cart items to the receipt and download history and etc, it will be a good head start if I knew where it is adding the products so I can prevent it from doing that somehow.