Compatibility with commerce_variation_cart_form

Created on 8 May 2025, 9 days ago

Problem/Motivation

This module provides the hook commerce_product_limits_form_commerce_order_item_add_to_cart_form_alter, which works correctly with the default Add to Cart form. However, if you're using the commerce_variation_cart_form module, the form IDs will differ (e.g., commerce_order_item_variation_cart_form_form_commerce_product_variation_1). As a result, this hook will not be triggered for those forms.

Proposed resolution

I propose replacing commerce_product_limits_form_commerce_order_item_add_to_cart_form_alter with a general hook_form_alter(), and checking the form object instance using AddToCartFormInterface. This approach ensures compatibility with all Add to Cart forms, including those provided by the commerce_variation_cart_form module.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine vitaliyb98

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024