Is there a way to add another form to the /cart page in drupal commerce? I have a need to show another view with operations on the cart page for stored shopping carts and quotes. I don't want to change the existing cart view, but add another view to that page.

Is there a way to make this into a panels page and still integrate with the rest of checkout? any suggestions?

  • 1
    Edit the cart view and embed the other view in it? Add a block display for the other view and place that block in an appropriate region just on the cart page? There are probably quite a lot of ways to do this depending on your config/theme/etc – Clive Feb 16 '17 at 22:24
  • I don't think embedded view would work because I need it as a separate form so it can be submitted separately from cart form. Yes, a block would work of course, can't believe I didn't think of that. Am doing most of site in panels. thanks – troseman Feb 17 '17 at 3:21

The way I did it was I implemented my own menu item for 'cart' and embedded the cart view on the page where I wanted it, while implementing other things I needed on the page. Definitely not for the faint of heart, though.

In this approach, your page callback is building the elements to be rendered, so you could use views_embed_view with the appropriate args if needed, pass them as variables, and render your page template where you want them.

Note: this is for Drupal Commerce in Drupal 7.

| improve this answer | |
  • did you still use /cart for your page? if not was there any problem using your own "cart" page with the regular checkout? did you have to change Add to Cart forms, etc? – troseman Feb 17 '17 at 3:12
  • 1
    I customized a lot. But I had a similar situation where I needed to put things above and below the view and adjust the page template, and in this specific case, overriding the route was the best option. The markup couldn't be achieved as view attachments. – Kevin Feb 17 '17 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.