Jump to content

Add new product feature via API


Sylv

Recommended Posts

Here's a snippet that might help:

$feature = array(
  'key' => 'Size',
  'value' => 'humongous',
);

$id_feature = Feature::addFeatureImport($feature['key']);
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature['value']);
$feature_value = new FeatureValue($id_feature_value);
$feature_value->custom = 0;
$feature_value->update();
Product::addFeatureProductImport((int) $product->id, $id_feature, $id_feature_value);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...