#1030 # Bug report — Group Products 6.0.5: `CartHelper::getCurrentCartId()` does not exist

Posted in ‘Technical Support / Bugs’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

J2Commerce

Version
J2Commerce v6

Latest post by Adam Melcher on Friday, 11 September 2026 19:42 UTC

Richard Sparks

## Summary

Setting any product's **Product Type** to **Group Products** breaks that product completely — both the admin article edit form and the frontend product page fatal with:

``` Error: Call to undefined method J2Commerce\Component\J2commerce\Administrator\Helper\CartHelper::getCurrentCartId() ```

This isn't an edge case — it's on the main render path every group product goes through, in both the admin form and every frontend skin.

## Environment

- Joomla 6.1.3, J2Commerce 6.6.1 - **Group Products 6.0.5** (`plg_j2commerce_app_groupproducts`, id 1055), installed today (2026-09-11), enabled, Template Type = UIkit - Old Group Products 4.0.3 (`j2store` variant) present but disabled — not a factor

## Steps to reproduce

1. Edit any article that's a J2Commerce product with Product Type = Simple (or any non-group type).
2. J2Commerce tab → **Change Product Type** → **Group Products** → **Confirm Change**.
3. The J2Commerce tab immediately shows a generic **"Error loading J2Commerce product form."** notice and the panel renders empty. The product type change itself *did* persist to the database (`#__j2commerce_products.product_type = 'groupproducts'`).
4. Visit the product on the frontend (`index.php?option=com_j2commerce&view=product&id=id`) — full Joomla error page, HTTP 500.

Reproduced against article/product id 84/16 ("All 4 Pre-Printed Grid Practice Panels") on a sandbox category built for this test.

## Root cause (traced via a CLI reproduction outside the generic try/catch that normally hides this)

`ProductHelper::getFullProduct()` → `applyBehaviorEnhancements()` → `Groupproducts::onAfterGetProduct()` (`administrator/components/com_j2commerce/src/Model/Behavior/ Groupproducts.php:301`) calls:

```php $cartId = CartHelper::getInstance()-getCurrentCartId(); ```

`CartHelper` (`administrator/components/com_j2commerce/src/Helper/ CartHelper.php`) has **no `getCurrentCartId()` method at all** — not a typo-able near-miss, the method simply isn't defined anywhere in the installed J2Commerce 6.6.1 core. `grep -r getCurrentCartId` across the whole codebase turns up **8 call sites, all inside the Group Products app**, none inside a definition:

- `administrator/components/com_j2commerce/src/Model/Behavior/Groupproducts.php` (lines 301, 443) - `plugins/j2commerce/app_groupproducts/source/admin/Model/Behavior/Groupproducts.php` (lines 301, 443 — build source copy) - `plugins/j2commerce/app_groupproducts/source/site/templates/{uikit,bootstrap5}/view_groups.php` - `plugins/j2commerce/app_uikit/tmpl/{uikit,tag_uikit}/view_groups.php` - `plugins/j2commerce/app_bootstrap5/tmpl/{bootstrap5,tag_bootstrap5}/view_groups.php`

So it's not just the admin form and one frontend skin — it's every group-product render path in every installed J2Commerce skin (UIkit and Bootstrap 5), admin and site.

## Likely fix

`CartHelper` does have a method that resolves/creates the shopper's current cart — `getCart(int $cartId = 0, bool $needCreateCart = true, string $cartType = 'cart'): ?object` (doc-tagged `@since 6.0.6`), which returns a cart row including `j2commerce_cart_id`. That strongly suggests Group Products 6.0.5 was built against an earlier/different J2Commerce core API where `CartHelper` exposed a `getCurrentCartId()` convenience method directly, and that method was renamed or folded into `getCart()` at some point before 6.6.1 without every Group Products call site being updated to match. The fix is presumably either:

- restore a thin `getCurrentCartId(): int` convenience method on `CartHelper` that wraps `getCart()-j2commerce_cart_id ?? 0`, or - update all 8 Group Products call sites to `CartHelper::getInstance()-getCart()-j2commerce_cart_id ?? 0`.

## Impact

Group Products 6.0.5 cannot be used at all against this J2Commerce 6.6.1 install — every group product 500s on both the edit screen and the storefront the moment it's created. Since this is the app's entire purpose, this is release-blocking, not a minor bug.

## Note on error visibility

Worth a mention while you're in there: the admin article-edit field (`plg_content_j2commerce`'s `J2commerceField::getInput()`) catches every `\Throwable` and always shows the same generic "Error loading J2Commerce product form." message, and logs via `Factory::getApplication()-getLogger()-error()` — which, at least in this environment, doesn't appear to write to any file under `administrator/logs/` (no logger registered for that category by default). Finding this bug required reproducing the render outside the try/catch via a CLI script. A logged category with a file logger registered by default (or at minimum surfacing the exception message when Joomla's Debug System is on) would have made this a five-minute diagnosis instead of an hour.

Richard Sparks

Screenshot of the product article Edit in J2Commerce tab.

Adam Melcher

Richard,

I just emailed you the latest beta that you need for the plugin to work. It is calling a function that is new in J2Commerce 6.6.2. It is most likely releasing later today - but I am already using it on some of my own sites so you will be good on this until the release.

 

Adam

Growing Together

Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.

Adam Melcher

Richard,

I also looked into the article edit view error notifications and while AI was wrong (partly) in the last paragraph - it does have the Logger function writing to the administrator log files, it wasn't actually doing it so future debugging should be much easier between that and more specific error emssages.

 

Adam

Growing Together

Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.

Richard Sparks

Group Products is working now (thanks for the 6.6.1.23 beta) — I've built two bundles and both render correctly on their own product page (`index.php?option=com_j2commerce&view=product&id=id`): parent product with a live "Products in this group" table, correct prices/qty per child, Add to Basket.

My products don't use J2Commerce's own routed product/category pages, though — every product is a Joomla article, and all display content (images, description, price, cart) is placed via YOOtheme Pro's dynamic-content fields, including the ones your free **YOOtheme Pro Integration** app (`plg_system_yootheme_j2commerce`) adds. That's working well for simple products: binding a Text element to `Product ▸ Add to Cart` renders the full cart widget right on the article's own page. My images are are saved in Joomla custom fields and displayed through YOOtheme dynamic content slideshow element.

Question

**Is there a way to render the group-products picker itself — the table with a checkbox/qty per sub-product — somewhere other than the standalone `view=product` page?** Either:

- as its own field/context option on the YOOtheme integration (so it can go on the article's own page, the way `Product ▸ Add to Cart` does for simple products), or - as a shortcode mode I'm missing.

What I've found so far (may already be known to you)

Traced `ProductType::resolveAddToCart()` (the YOOtheme plugin's "Add to Cart" field) → it always calls `ProductLayoutService::renderLayout('list.category.item', $displayData)` — the category-listing-card layout. For group products, your own `item_groupproducts.php` comment explains why that card is just a link:

*"A grouped product has to be configured on its own page (which sub-products, at what quantity), so the list card always links through instead of offering an inline add-to-cart form — same reasoning as app_bundleproduct's card."*

Makes sense for a listing context. But since my product pages *are* single-item context already (one article = one product, no routed J2Commerce product page in use), I was hoping to land on the real picker there instead of a "View Product Details" link to a second page.

Also tried, both reverted after checking:

- `{j2commerce}id|cart{/j2commerce}` — resolves straight to `list.category.item_cart`, bypassing the product-type dispatcher. Renders a bare, non-functional "Add to Basket" button — no sub-product rows. - `{j2commerce}id|detail{/j2commerce}` — dispatches `onJ2CommerceViewProductHtml`. Rendered nothing when placed inside an article's own content field via the shortcode custom field (rather than reached through the normal `view=product` route).

If there's currently no built-in way to do this, no worries — just let me know and I'll either wait for a future release or find a workaround on my end (e.g. linking to the standalone product page instead of trying to embed the picker, and populating J2Commerce's own Images/Description fields for group products specifically so that page looks presentable).

I'm trying to upgrade my old J2Store sites to the current J2Commerce code but still retain the original configuration of product content, add to cart and checkout so I don't have to rebuild all my products.

Here's an example of my frontend v4 group product display I'm hoping to retain = https://www.quintessentialquilting.com/shop/notions/pre-printed-grid-practice-panels

Richard

Adam Melcher

Richard,

The danger with relying on AI for every answer is it makes everything seem like the correct answer. While it was correct in the ProductLayoutService::renderLayout('list.category.item', $displayData) function - that only works for the layout files that generate the category layout views - not the product detail views (which is why it wouldn't find the table view in a category view layout file). I will look to see what is needed to make sure that functionality is included in a shortcode.

 

Adam

Growing Together

Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.

Stay Updated

Subscribe for free and be the first to know about the latest features, updates, and new additions.