7

I'm new to Magento 2, and understand this is a change from Magento 1.

Example: I have a T-Shirt as a configurable product with colour options as Simple Products. These Simple Products all require the same price.

  • If I want to update the price of the configurable product (and thus the Simple Product variations) how do I easily do this?
  • Same question with regards to applying a special price
  • How would I apply tiered pricing to all Simple Product variants?

As far as I can see, this is only possible via the product catalogue screen: find a way to select all the Simple Product variations of that configurable product then apply a bulk action to change the price / special price. This seems very long-winded and tricky - say I had 50 variations on a product all with different SKUs: even filtering then selecting all of those in the Product Catalogue would be a task.

Therefore, I'm assuming I'm missing something! I'd guess a huge portion (majority?) of users who create configurable products will want to apply a single price to all variations (Simple Products). Simple Products should have the option of inheriting the price from their configurable product.

I believe Magento 1 handled this differently and did use the configurable product's price until explicitly overridden via a Simple Product variation. This seems far more sensible to me... though happy to be educated here!

0

I've found a ticket for the tiered pricing element of this question on the M2 feature request platform:

https://community.magento.com/t5/Magento-2-Feature-Requests-and/Configurable-products-tier-prices-and-attributes/idi-p/46183

It's been hanging around for 6 months now (as of 21/03/17) so if you're suffering from this please check the ticket and up-vote!

0

You can do this when create new product

  • Create simple product

  • Setup price/special price/tier price for it

  • Create configuration for this simple product (it will become configurable product)

Note: you can't edit configurable product price later

  • Hi MageX, thanks for the post. This is the crux of my question though: the easy updating of prices (regular, special and tiered pricing) is a critical business activity and is either difficult or impossible to do efficiently, as far as I can see. – Tom Bates Mar 21 '17 at 11:09
0

I was getting same issue when Migrated data from Magento to Magento 2.As Magento 2 change scenario to set the Special price for configurable product and we need to require set special price for every associated product of configurable product.

    <?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

use Magento\Framework\App\Bootstrap;

try{

    require __DIR__ . '/app/bootstrap.php';

    $params = $_SERVER;
    $bootstrap = Bootstrap::create(BP, $params);
    $obj = $bootstrap->getObjectManager();
    $obj->get('Magento\Framework\Registry')->register('isSecureArea', true);
    $appState = $obj->get('\Magento\Framework\App\State');
    $appState->setAreaCode('frontend');

    $products = $obj->create('\Magento\Catalog\Model\Product')->getCollection();
    $products->addAttributeToSelect(array('special_price','price'))
        ->addFieldTofilter('type_id','configurable')
        ->addFieldToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
        ->addFieldToFilter('status', \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
        ->load();



    echo "Total products count: " . $products->count() . "<hr>";
    echo "<pre>";
    if ($products->getSize() > 0) {
        foreach ($products as $product) {


            $configSpecial = $product->getSpecialPrice();

            if($configSpecial > 0)
            {
                echo 'product id<br/>'.$product_id = $product->getId();
                $configProduct = $obj->create('Magento\Catalog\Model\Product')->load($product_id);
                $_children = $configProduct->getTypeInstance()->getUsedProducts($configProduct);



                 foreach ($_children as $child){



                     $childProductId = $child->getID();

                     $childproduct = $obj->create('Magento\Catalog\Model\Product')->load($childProductId);


                     $childproduct->setStoreId(9);
                     //$childproduct->getName(); 
                     $childproduct->setSpecialPrice($configSpecial); 
                     $childproduct->save();
                     //echo $childproduct->getSpecialPrice(); 
                }

                //echo "count: ".count($_children);



           }



            //print_r($product->getData());
        }
    }

} catch (Exception $e) {
    echo $e->getMessage();
}

I hope this script will help you.

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.