简体   繁体   English

Magento 2 - 以编程方式删除产品的 Tierprices

[英]Magento 2 - Delete Tierprices of products programmatically

I tried several ways to remove tierprices and looked they were performed well with no issues.我尝试了几种方法来删除 tierprices 并且看起来它们表现良好,没有任何问题。 But there are no changes in products and the tierprices are still remain.但是产品没有变化,等级价格仍然保持不变。 Please recommend any solution for this please.请为此推荐任何解决方案。

$connection = $this->resource->
  getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);

$sql = 'DELETE FROM `catalog_product_entity_tier_price` 
       WHERE `value_id` = ' . $price['price_id'];

$connection->query($sql);

We can remove tierprices directly via database by running query.我们可以通过运行查询直接通过数据库删除 tierprices。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM