Jump to content
Jen29

Fix Digital Product Stock Level

Recommended Posts

I'm selling exclusive digital content. When someone purchases an item it can not be purchased by anyone else. I have the stock level set to 1 but it shows as infinity available on the Product Inventory page. Where/how can I change this?

Share this post


Link to post
Share on other sites

Welcome Jen29! Glad to see you made it to the forums.

Currently, CubeCart is not coded to do this. That is, a digital item cannot be restricted by stock levels.

But we can probably develop a code snippet to override this.

Please let us know if you are running a specific version of CubeCart, or if we can plan for the latest version.

My initial reply was probably for CubeCart many versions ago.

Edited by bsmither

Share this post


Link to post
Share on other sites

There is a very simple edit to show actual stock levels on digital items when viewing the Product Inventory list.

Also, experiments with my installation of CC618 will restrict purchases of digital items to the actual stock level - provided that, in admin:

Store Settings, Stock tab: "Allow out-of-stock purchases" is unchecked, and "Reduce stock levels" is set to Pending (probably the better of the three settings).

Add/Edit a digital product, General tab: "Use Stock Level" is checked, and there is a numeric value for Stock Level.

Here is the code edit:

Using a programmer's text editor, in the file /admin/sources/products.index.inc.php, near line 1180:

From:

if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) {
	$result['stock_level'] = "∞";
}

To:

if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) {
//	$result['stock_level'] = "∞";
}

 

Share this post


Link to post
Share on other sites

Hi Brian, Happy New Year and all the best for 2018.  Your snippet of code has saved me once again.

Thanks to Jen29 for asking too.

regards Duncan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×