Add option value to product, then to cart with Magento

后端 未结 4 1105
暗喜
暗喜 2021-01-02 12:33

I searched around for a while and only came up wit solutions that added whole new option sets to products in a Magento store.

What I\'m trying to accomplish is a wa

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 12:56

    You should write the input parameter for addproduct as the following format, it is tested by myself:

    $params = array(
        'product' => 1, // This would be $product->getId()
        'qty' => 1,
        'super_attribute' => array(
            34 => "value",
            35 => "other value",
            53 => "some other value"
        )
    );
    

提交回复
热议问题