作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用 woocommerce api 创建新产品。我有一个颜色属性,我想识别 sku 中的产品,例如 codeblack。
我的问题是如何做到这一点。
在创建带有倾斜、描述、sku 等的产品时,这是可以的。为了创建具有属性的产品,我添加了 'type' => 'variable'
。
现在我有了属性,我启用了变体,但我无法为我的变体赋予值(value)。
这是我的代码
$client->products->create(
array(
'title' => 'Premium Quality',
'type' => 'variable',
'sku' => 'code',
'regular_price' => '29.98',
'description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
'short_description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
'images' => array(
array(
'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg',
'position' => 0
),
array(
'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg',
'position' => 1
)
),
'attributes' => array(
array(
'name'=>'color',
'slug'=>'color',
'position'=>'0',
'visible'=>'true',
'variation'=>'true',
'options'=>array('red','black')
)
),
'variations' => array(
array(
'sku' => 'codered',
'regular_price' => '29.98',
'attributes' => array(
array(
'name'=>'color',
'options'=>'red'
)
)
),
array(
'sku' => 'codeblack',
'regular_price' => '29.98',
'attributes' => array(
array(
'name'=>'color',
'options'=>'black'
)
)
)
)
)
);
最佳答案
关于api - woocommerce api 创建具有变体的新产品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37823867/
您好,我正在与 bigcommerce 合作,我希望在每个类别页面上获得以下风格的分割 本质上是制作类别版本; %%Panel.HomeFeaturedProducts%% %%Panel.SideT
我是一名优秀的程序员,十分优秀!