4

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

6

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="-"/>
  • not coming Rakesh – Nadh Dec 16 '16 at 10:59
  • you can check in console in stock and sku are display after price div – Rakesh Jesadiya Dec 16 '16 at 11:06
  • it is coming after div only before also but not displaying – Nadh Dec 16 '16 at 11:17
  • i have updated my answer. – Rakesh Jesadiya Dec 16 '16 at 11:24
  • thanks i will check Rakesh, how to move custom options to right i.e size ,color dropdown – Nadh Dec 16 '16 at 11:27
1

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

<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>
  • I would never recommend to change the code inside a core module as this will cause issues with any magento updates in future. – David Manners Dec 16 '16 at 15:23
  • 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 – Dipesh Rangani Dec 18 '16 at 6:46

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.