I'm using Drupal commerce and it's cart form for a client's site and I cannot manage to find an accurate template to customize it. The cart's form is rendered from a view. I'm trying to suggest a theme using theme_suggestions_form_alter hook and it registers and applies my custom template name successfully. However, when I'm trying to get the template's variable, all I get is the entirety of the form's markup... I've tried moving upward, targeting the view's template, however variables this time are only the views arguments for building the form. Here's the themes_suggestions hook I'm using (I don't think if it will be of much help but hey) :

  if (str_contains($variables['element']['#form_id'], 'views_form_commerce_cart_form_default')) {
    $suggestions[] = 'form__commerce_cart_form_default';


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.