Search code examples
phpdrupalbuttonubercartcart

add to cart button in blocks drupal ubercart


I want to add an add to cart button on several pages that links to a specific product. can I do that with some PHP code? like loading a form or something , or link to a product id? It would be nice if I can add a block, paste some php code in it and assign it to the pages that I choose.


Solution

  • If it is one specific product you can do this with Ubercarts built in "Cart Links". You need to enable the module for it and then in your store settings specify which products should be available as cart links. The settings page will also tell you how to construct the link.

    You can also review this page on ubercart.org for reference.