Is there a way of saving changes made to the individual products? I have the following below code:

$product = $this->_productRepository->get($productID);
    $product->setCustomerGroupId($customerGroupID); // Binds the given customer group ID to the product. This is done so prices for the group can be set
    $product->setCustomerGroupPrice($customerGroupPrice); // Binds the given group price to the product
    $product->save(); // Saves the product changes to the DB

My problem however is that the save() does not actually save the changes. I'm fairly sure save() is purely meant for the Object Manager however I don't want to use that. I'm aware that :


can save new products to the product repository however I only want to update an exist product.

Additionally, i'm interested on any other suggestions on how to properly assign a Customer Group ID and then a price to that newly signed ID opposed to what I currently have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.