Created
January 27, 2019 12:47
-
-
Save digitalgeneralist/2469dda6dd9b3f74f9536b19d83c6334 to your computer and use it in GitHub Desktop.
Set Attr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You can set other product data with $product->setAttributeName() if you want to update more data | |
if ($product->getPrice() != $price) { | |
$product->setPrice($price) | |
->setStoreId(0) // this is needed because if you have multiple store views, each individual store view will get "Use default value" unchecked for multiple attributes - which causes issues. | |
->save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment