craftcms / digital-products

Sell digital products with Craft Commerce.
https://plugins.craftcms.com/digital-products
MIT License
18 stars 9 forks source link

Integrate Digital Products to Craft Commerce as Product Type #65

Open aloco opened 3 years ago

aloco commented 3 years ago

Description

Hi we are using Digital Products along with Products from Craft Commerce. We don´t really distinguish between Commerce Products and Digital Products, they share almost the same fields and are shown mixed together in search results, product slider and so on.

We often run into the situation where we need two relation fields on an entry like a shop over view page -> one for Digital Products and one for Commerce Products. Therefore it is difficult for an editor if the editor wants to create a List of Products in a specific order, mixed with Digital Products and Commerce Products. We are using Matrix or Supertable Fields as kind of "wrapper" to overcome this.

It is also difficult to query for both Product Types, we often end up in doing something like this

use craft\commerce\elements\Product;
use craft\digitalproducts\elements\Product as DigitalProduct;

$products = Product::find()->all();
$digitalProducts = DigitalProduct::find()->all();
$mergedProducts = array_merge($products, $digitalProducts);

I think it would be very awesome if those Digital Products are somehow integrated into Craft Commerce native so they can be used side by side in an easier way. I understand that Digital Products might be out of scope of Commerce Core, but since both are Purchasables there might be better ways in querying them side by side than in my example. It would also help if we could pick Digital Products and Commerce Products within one custom field like different Product Types in Commerce. What is your opinion on this?

MattWilcox commented 3 years ago

Same issue, we can't really do a simple "recent products" or "search products" in Twig with these separated out as they are. Unless I'm missing some strategy that will work.