public function testSuccessfullyRemoveTierPriceSpecifiedForSpecificGroups() { $this->productMock->expects($this->once())->method('getData')->with('tier_price')->will($this->returnValue($this->prices)); $expectedPrices = [1 => $this->prices[1]]; $this->productMock->expects($this->once())->method('setData')->with('tier_price', $expectedPrices); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); $this->priceModifier->removeTierPrice($this->productMock, 1, 15, 1); }
/** * {@inheritdoc} */ public function delete($productSku, $customerGroupId) { $product = $this->productRepository->get($productSku, true); if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { $websiteId = 0; } else { $websiteId = $this->storeManager->getWebsite()->getId(); } $this->priceModifier->removeGroupPrice($product, $customerGroupId, $websiteId); return true; }
/** * {@inheritdoc} */ public function remove($sku, $customerGroupId, $qty) { $product = $this->productRepository->get($sku, ['edit_mode' => true]); $websiteIdentifier = 0; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); if ($value != 0) { $websiteIdentifier = $this->storeManager->getWebsite()->getId(); } $this->priceModifier->removeTierPrice($product, $customerGroupId, $qty, $websiteIdentifier); return true; }