1
<move element="product.info.stock.sku" destination="product.info.addtocart" as="product.info.stock.sku.old"/>
<move element="product.info.stock.sku" destination="product.info.addtocart.additional" as="product.info.stock.sku.additional"/>

I have tried the above code in catalog_product_view_type_simple.xml file and getting as

<?=$block->getChildHtml('product.info.stock.sku.old',true);?>
<?=$block->getChildHtml('product.info.stock.sku.additional',true);?>

But only one work at a time, actually I want to move sku in simple product which has options or not.

  • in which page you need to move elements – shivashankar m May 9 '18 at 12:24
  • single product page but its done by such method given by @Sander Jongsma But If you have better answer so, you can post. – Gagandeep Singh May 10 '18 at 10:09
0

You can not move one element to 2 positions. It doesn't have a clone function or somethings. So in order to do this you will need to create a second block for this, like:

<container name="product.info.stock.sku.copy" label="Product auxiliary info" htmlTag="div" htmlClass="product-info-stock-sku">
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku.copy" template="Magento_Catalog::product/view/attribute.phtml">
        <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>

Use other names to avoid collisions.

  • Thanks, But i already did with method like you suggest. I supposed cloning is exist in magento 2. – Gagandeep Singh May 10 '18 at 10:08

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.