Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save digitalgeneralist/2469dda6dd9b3f74f9536b19d83c6334 to your computer and use it in GitHub Desktop.
Save digitalgeneralist/2469dda6dd9b3f74f9536b19d83c6334 to your computer and use it in GitHub Desktop.
Set Attr
// 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