2

I would like to move the "product-price" so it is just over the "add-to-cart".

The problem is I didn't find the exact "destination".

Had some minor success, either on "configurable products" or on the "simple product" view.

So my question is it possible to move if "configurable product" -->destination a or "simple product" -->destination b

Destination A:

<move element="product.price.final" destination="product.info.options.wrapper" after="-" />

Destination B: <move element="product.price.final" destination="product.info.form.content" before="-" />

Thanks for your help

The idea with "basket.button.price" didn't work. Here my xml:

<container name="product.info.form.content" as="product_info_form_content">
<container name="basket.button.price" htmlTag="div" htmlClass="basket__elements"></container>
    <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="product.info.addtocart" template="product/view/addtocart.phtml"/>
</container>
<block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container">
    <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="product/view/options/wrapper.phtml">
        <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml">
            <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="product/view/options/type/default.phtml"/>
                <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" as="text" template="product/view/options/type/text.phtml"/>
                    <block class="Magento\Catalog\Block\Product\View\Options\Type\File" as="file" template="product/view/options/type/file.phtml"/>
                    <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/>
                    <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" as="date" template="product/view/options/type/date.phtml"/>
                </block>
            <block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
        </block>

    <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="product/view/options/wrapper/bottom.phtml">
        <container name="basket.button.price" htmlTag="div" htmlClass="basket__elements"></container>
            <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="product/view/addtocart.phtml"/>
        </block>
    </block>

1

I added this xml file to move "product.price.final" to "product.info.form.options" destination.

File

app/design/frontend/Vendor/theme/Magento_ConfigurableProduct/layout/catalog_product_view_type_configurable.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="product.price.final" as="product.info.main.bottom.price" destination="product.info.form.options" before="product.info.options.wrapper.bottom"/>
    </body>
</page>
0

Okay, how i've gone about this is like so. You know that the block name you want to move and you also want to know the name of the secondary block you want to move.

Once you know these, because magento as a base theme doesn't exactly have the correct html structure you want, well it didn't have the correct one i wanted but still - you need to modify it to make it how you want it.

So. Lets create a container. ( inside of the main container - or wherever you wish ) this will be in the following:

Vendor/default/Magento_Catalog/layout/catalog_product_view.xml

Then lets create the container

<container name="basket.button.price" htmlTag="div" htmlClass="basket__elements">

Now once this container has been registered lets move your 2 blocks to this destination:

<move element="product.price.final" destination="basket.button.price" after="-" />

done. This will move your blocks from one location to the one you want. Easy peasy. :)

You can also target specific layouts like you're after:enter image description here

I'm not going to include all the xml for this file because my theme is riddled with so much (and i don't have time to rip it apart), but you should be able to understand what I've done ther with the snippets above.

Hope this helps.

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.