0

We need to create a script that creates product attributes.

Product attribute comes from third-party API when creating a product attributes its checks attribute is available or not.

If that is not available then it creates at that time product attributes. Thank you!

asked May 10, 2021 at 9:52

2 Answers 2

3

yes I have got a solution for creating attributes using script and API

  1. create attribute using Magento 2 default API http://127.0.0.1/magento2/rest/all/V1/products/attributes

  2. check attributes available or not using API http://127.0.0.1/magento2/api/Product/ProductAttribute/Options/{attribute_id}

  3. get attribute id from attribute code using rest API http://127.0.0.1/magento2/rest/all/v1/products/attributes/{attributecode}

answered Oct 18, 2021 at 13:14
1

Follow the following steps

  1. Log in to Admin Panel
  2. Navigate to Stores > Attributes > Product
  3. Click "Add New Attribute"

Fill-up the required details and save it, after that assign that attribute, specific attribute set.

answered May 10, 2021 at 12:42
3
  • I need to create a script not need to create a manual attribute from the admin Commented May 11, 2021 at 5:28
  • As you have mentioned it you don't want to create it using install data, so use upgrade data. Commented May 16, 2021 at 16:53
  • I have mentioned Script it means need to create programmatically. Commented May 26, 2021 at 5:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.