After struggling the whole week to create an simple extension for a project of mine, I thought I finished and covered everything. Turns out I was wrong. The thing that I cannot make it work properly is related to the frontend layout. I wanted to add a custom block to the layout inside the "add to cart" area. In order to do this I added the following xml code inside my extension's layout file (after searching docs and testing an entire day):

        <reference name="product.info.options.wrapper.bottom">
                <block type="catalog/product_view" name="my.foobar" before="addtocart" template="catalog/product/view/foobar.phtml"/>
                <action method="append">

I thought this was it. That this will add my block to all products above the "add to cart" button area. As you can see I used "product.info.options.wrapper.bottom" as reference. The block appeared where I wanted to, I was happy. My mistake was that I tested on a product page of a configurable product. Today I saw that the "product.info.options.wrapper.bottom" block is not visible on all types of products, making my block to also not be displayed on all products, for instance on a simple product page (unfortunately). I tried different other blocks as a reference, but everything was in vain. I don't know why the original layout puts the "add to cart" container in different parts of the product sidebar. This causes my layout change not to work for all types of products.

Right now I don't know what to add/modify. Can anyone help me with this ?

edit: Here is an image to better reflect the area where I want my block to be positioned

enter image description here

2 Answers 2


I guess it depends on what your trying to add and if it needs to be at a particular point e.g before or after the add to cart button.

If after the addtocart button is ok you can use product.info.addtocart since it calls <?php echo $this->getChildHtml('', true, true) ?>.


    <reference name="product.info.addtocart">
        <block type="core/text" name="core-text"><action method="setText"><text><![CDATA[<div>Test</div>]]></text></action></block>

Update: If you wrap the text in a div as I have updated above it will work in the default theme like below. But this may not work quite right in other themes like the new rwd.

enter image description here

  • thanks for your answer. I actually tried this during my tests but this adds the block below the add to cart button, as I said, but leaves a big margin to its left i.imgur.com/bMyQQQY.png. I want the block to be positioned at the beginning of the row (if I better think of it, it should be above/below the quantity field container). I will update my question to better reflect this.
    – misterjinx
    Sep 7, 2014 at 9:47
  • and regarding to what I'm trying to add, it's a block representing a template file (catalog/product/view/foobar.phtml) which displays a link depending on some product options
    – misterjinx
    Sep 7, 2014 at 9:59
  • If it is just for you own use you can edit your catalog/product/view/addtocart.phtml file and move the $this->getChildHtml call, however if its for something you will distribute there is not a nice way to do this so that it works exactly how you want on many themes. Sep 7, 2014 at 11:42
  • I thought about this, and perhaps for this project I will end up modifying that file, but I've been thinking while working on this extension that would be nice of me to release this extension to the public, for free, since there's not another one free that does the same thing and I know how much time it took to develop it. But if I don't manage to make it work at least with the default theme I don't think that I will be able to do what I intend :(
    – misterjinx
    Sep 7, 2014 at 12:23
  • It works with the default theme, see update. Sep 7, 2014 at 12:33

you can add custom block above add to cart and render template for that block like this.

<reference name="product.info.options.wrapper">
    <block type="core/template" name="newReferenceBlock" template="customa.phtml" />

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.

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