plugineria/product-shipping-price-magento2

在Magento2中显示产品运费

安装: 0

依赖项: 0

建议者: 0

安全: 0

星标: 0

Forks: 0

类型:magento2-module

1.0.0 2021-02-21 05:48 UTC

This package is auto-updated.

Last update: 2024-09-21 23:53:08 UTC


README

在产品页面上直接估算产品运费。

  • 计算产品页面上可用的最低运费。
  • 在将产品添加到购物车之前显示单个产品的所有可用运费选项。
  • 提供REST API端点
  • 可以配置默认的运费地址或使用注册用户的现有地址。

测试的运费方式

  • 平邮费
  • DHL
  • UPS
  • 美国邮政服务
  • 联邦快递
  • 免费运费
  • 表格运费

测试的产品类型

  • 简单
  • 虚拟
  • 可配置

架构

这是一个基于Magento2模块的实现,采用了六边形架构,由Yury Ksenevich创建。

源代码分为4层

  1. 领域/业务逻辑 - 在plugineria/product-shipping-price库中实现。
  2. 应用逻辑 - 在plugineria/product-shipping-price库中实现。
  3. 基础设施 - 针对业务逻辑的Magento特定适配器,位于Magento2/Infrastructure/
  4. UI - API端点、前端控制器和路由器位于Magento2/Ui/

系统要求

  • 测试过的Magento版本:2.3.6+,2.4.1+
  • PHP 7.3或7.4

作为Magento2模块安装

:warning: 请注意,您只能使用composer安装此扩展。

  1. 备份您的商店数据库和网页目录
  2. 打开终端并移动到Magento根目录

  3. 在控制台中运行以下命令

composer require plugineria/product-shipping-price-magento2
bin/magento module:enable Plugineria_ProductShippingPrice
  1. admin > Stores > Configuration > Plugineria > Product Shipping Price > Example Shipping Address中配置示例运费地址

  2. 刷新缓存

REST API

GET /V1/products/{sku}/shippingRates

获取产品的运费列表

请求参数

  • sku - 字符串产品SKU

响应

[
  {
    "price": 0,
    "code": "string",
    "title": "string",
    "description": "string",
    "shipping_method": {
      "id": "string",
      "title": "string"
    }
  }
]

GET /V1/products/{sku}/shippingRates/minimal

获取产品的最低运费

请求参数

  • sku - 字符串产品SKU

响应

如果找到运费

{
  "price": 0,
  "code": "string",
  "title": "string",
  "description": "string",
  "shipping_method": {
    "id": "string",
    "title": "string"
  }
}

如果没有找到运费

{}

用户界面

产品页

添加到购物车部分中的最低运费块

Minimal estimated shipping rate

显示产品所有运费的弹出窗口

All shipping rates for product

许可证

贡献

通过对此项目的贡献,您授予所有用户在全球范围内、免版税、永久、不可撤销、非独占、可转让的许可,许可条件与本项目分发的许可条款相同。