【问题标题】:removing add to cart button on Magento 2删除 Magento 2 上的添加到购物车按钮
【发布时间】:2018-01-19 14:53:29
【问题描述】:

我有一个租赁类别,我只想显示价格,不允许人们添加到购物车。 (在列表视图和详细信息视图中)。我怎样才能在 Magento 2 上做到这一点?

P.S 我还有其他类别需要正常工作。

【问题讨论】:

    标签: magento2


    【解决方案1】:

    我更喜欢添加一个属性 ex。 IsRental (Yes/No) 分类并保存所有出租类别的属性值。

    比之后你可以覆盖Magento\Catalog\Pricing\Render\FinalPriceBox函数_toHtml

    在此您可以从注册表中检查当前类别的属性 IsRental 并返回空白,否则返回 parent::_toHtml()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-03
      • 2012-08-16
      • 2018-10-10
      相关资源
      最近更新 更多