Needs review
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2015 at 16:06 UTC
Updated:
16 Oct 2015 at 17:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pq commentedPatch attached.
Comment #3
rszrama commentedI'm not sure if we need / want to introduce a hook here. The problem is it reduces the usefulness of the line item argument having in it all the context required to recreate an Add to Cart form. Would it be possible for you to alter the line item before it gets passed into this form? One potential could be a wrapper function inserted via hook_forms(), but I'm not sure it sufficiently supports altering wrapper callbacks onto other modules' forms.
Comment #4
pq commentedI tried that, the problem is that in commerce_cart_add_to_cart_form_product_ids() the condition that causes the product IDs to be populated is as follows:
So basically it loads the host entity and gets the raw values from there, so the only way to hook into that without modifying commerce_cart.module would be to hook into the entity load and unset them there but that would have all sorts of horrendous side effects.