Jump to content

Add new product feature via API


Sylv
 Share

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);

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More