When adding a product to cart via rules, the line item type always saved as 'product' even if product type is not a product.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anas_maw created an issue. See original summary.

Anas_maw’s picture

Status: Active » Needs review
FileSize
701 bytes

Here is a patch that should solve this issue.

jsacksick’s picture

Status: Needs review » Closed (works as designed)

The function expects a line item type, not a product type...

Anas_maw’s picture

Status: Closed (works as designed) » Needs review

@jsacksick,
I think that you didn't get the idea.
When using this action to add a line item, it's always saved as line item product type in database, regardless of line item type.
Please have another look.
Thanks,

jsacksick’s picture

Status: Needs review » Closed (won't fix)

Once again, I think you're confusing the product variation type and the line item type, which isn't the same thing...

See below:

 * @param $type
 *   The type of product line item to create. Must be a product line item as
 *   defined in the line item type info array, and the line item type must
 *   include the expected product related fields. Defaults to the base product
 *   line item type defined by the Product Reference module.

You could have a "tshirt" product variation type with no matching line item type, in that case this logic would fail. By the way nothing prevents you from exposing a custom rules action that follows this logic if that's how your site is configured.