6

How to move sku and instock to down to price in product details page,by default it is coming right side of price but i want it after price

2 Answers 2

11

Keep below code inside xml file body tag in your xml file,

app/design/frontend/{Vendor}/{themename}/Magento_Catalog/layout/catalog_product_view.xml

<move element="product.info.type" destination="alert.urls" before="-"/>
<move element="product.info.stock.sku" destination="alert.urls" before="-"/>
5
  • not coming Rakesh
    – User0434
    Commented Dec 16, 2016 at 10:59
  • you can check in console in stock and sku are display after price div Commented Dec 16, 2016 at 11:06
  • it is coming after div only before also but not displaying
    – User0434
    Commented Dec 16, 2016 at 11:17
  • i have updated my answer. Commented Dec 16, 2016 at 11:24
  • thanks i will check Rakesh, how to move custom options to right i.e size ,color dropdown
    – User0434
    Commented Dec 16, 2016 at 11:27
0

Change below code in Magento_Catalog\layout\catalog_product_view.xml file in your custom theme:

<container name="product.info.price" label="Product info auxiliary container" htmlTag="div" htmlClass="product-info-price" after="product.info.review">
                            <container name="product.info.stock.sku" label="Product auxiliary info" htmlTag="div" htmlClass="product-info-stock-sku">
                                <container name="product.info.type" before="-"/>
                                <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
                                    <arguments>
                                        <argument name="at_call" xsi:type="string">getSku</argument>
                                        <argument name="at_code" xsi:type="string">sku</argument>
                                        <argument name="css_class" xsi:type="string">sku</argument>
                                        <argument name="at_label" xsi:type="string">default</argument>
                                        <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>
                                    </arguments>
                                </block>
                            </container>
                            <block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="product/view/review.phtml" after="product.info.stock.sku" />
                            <block class="Magento\Catalog\Pricing\Render" name="product.price.final" after="product.info.sku">
                                <arguments>
                                    <argument name="price_render" xsi:type="string">product.price.render.default</argument>
                                    <argument name="price_type_code" xsi:type="string">final_price</argument>
                                    <argument name="zone" xsi:type="string">item_view</argument>
                                </arguments>
                  </block>
  </container>

to

<container name="product.info.price" label="Product info auxiliary container" htmlTag="div" htmlClass="product-info-price" after="product.info.review">                    
    <block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="product/view/review.phtml" after="product.info.stock.sku" />
    <block class="Magento\Catalog\Pricing\Render" name="product.price.final" after="product.info.sku">
        <arguments>
            <argument name="price_render" xsi:type="string">product.price.render.default</argument>
            <argument name="price_type_code" xsi:type="string">final_price</argument>
            <argument name="zone" xsi:type="string">item_view</argument>
        </arguments>
    </block>
</container>

<container name="product.info.stock.sku" label="Product auxiliary info" htmlTag="div" htmlClass="product-info-stock-sku">
    <container name="product.info.type" before="-"/>
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
        <arguments>
            <argument name="at_call" xsi:type="string">getSku</argument>
            <argument name="at_code" xsi:type="string">sku</argument>
            <argument name="css_class" xsi:type="string">sku</argument>
            <argument name="at_label" xsi:type="string">default</argument>
            <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>
        </arguments>
    </block>
</container>
2
  • I would never recommend to change the code inside a core module as this will cause issues with any magento updates in future. Commented Dec 16, 2016 at 15:23
  • 1
    I never said to change this in core module, You need to change this in your custom theme's Magento_Catalog\layout\catalog_product_view.xml Commented Dec 18, 2016 at 6:46

Your Answer

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

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