clawrock / m2-product-shipping
模块负责在产品查看页面上显示运输方式。
1.0.0
2018-03-15 11:40 UTC
Requires
- magento/framework: >=100.1
- magento/module-bundle: >=100.1
- magento/module-catalog: >=101.0
- magento/module-configurable-product: >=100.1
- magento/module-directory: >=100.1
- magento/module-quote: >=100.1
- magento/module-swatches: >=100.1
- magento/module-tax: >=100.1
- magento/zendframework1: ^1.12
Requires (Dev)
- phpunit/phpunit: ~6.2.0
This package is auto-updated.
Last update: 2024-08-29 04:49:44 UTC
README
模块负责使用预定义的国家显示产品查看页面上可用的运输方式。
要求
- Magento 2.1+
安装(使用composer)
composer require clawrock/m2-product-shipping
php bin/magento setup:upgrade
安装(手动)
- 将仓库克隆到
app/code/ClawRock/ProductShipping
php bin/magento setup:upgrade
配置
- 转到 Stores -> Configuration -> ClawRock -> Product Shipping
- 选择用于计算可用运输方式的国家,否则将不会返回运输方式
- 您还可以编辑当API返回空数组(找不到运输方式)时显示的消息
API
您可以使用API请求获取产品的运输方式。
Endpoint: rest/V1/product-shipping-methods
Method: POST
简单产品
主体
options: {
"qty": 1,
"sku": "S03"
}
可配置产品
主体
options: {
"super_attribute": {
"142":"167",
"93":"58"
},
"qty": 1,
"sku": "WS03"
}
super_attribute 数组中的键是超级属性ID,值是选项ID,例如 142 是 color 属性,167 是 red 选项。
捆绑产品
主体
options: {
"bundle_option": {
"1" : [3]
},
"bundle_option_qty": {
"1": 5
},
"qty": 1,
"sku": "24-WG080-1"
}
bundle_option 数组中的键是选项ID,值是选择ID。一个选项中可能有多个选择,即多选或复选框。在 bundle_option_qty 数组中的键是选项ID,值是选项的数量。
测试
要在控制台中运行测试,请执行:vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist