npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

medusa-product-options-metadata-voxsar

v0.1.0

Published

The Medusa Product Options Metadata Plugin extends the product options API to include the ability to add metadata to options and option values. This plugin enables you to list all options of a product, manage individual options, and update their metadata.

Downloads

45

Readme

Compatibility

This plugin is compatible with versions >= 1.8.0 of @medusajs/medusa. Getting Started

Medusa Product Options Metadata Plugin

Description

The Medusa Product Options Metadata Plugin extends the product options API to include the ability to add metadata to options and option values. This plugin enables you to list all options of a product, manage individual options, and update their metadata.

API Admin Endpoints

These endpoints allow you to manage product options and their metadata within your Medusa project.

List All Options for a Product

Endpoint:

GET /admin/products/{productId}/options

Description: Retrieves all options for a specified product.

Parameters: productId: The ID of the product.

Get a Specific Option for a Product

Endpoint:

GET /admin/products/{productId}/options/{optionId}

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option.

Get all Values of a Specific Option for a Product

Endpoint:

GET /admin/products/{productId}/options/{optionId}/values

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option.

Get a Specific Value of a Specific Option for a Product

Endpoint:

GET /admin/products/{productId}/options/{optionId}/values/{valueId}

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option. valueId: The id of the value option

Update Metadata for a Specific Option

Endpoint:

POST /admin/products/{productId}/options/{optionId}

Description: Updates the metadata for a specific option of a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option.

Request Body:

json

{
  "metadata": {
    "key": "value",
    "anotherKey": "anotherValue"
  }
}

Update Metadata for a Specific Value in a Option

Endpoint:

POST /admin/products/{productId}/options/{optionId}/values/{valueId}

Description: Updates the metadata for a specific option of a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option. valueId: The id of the value option

Request Body:

json

{
  "metadata": {
    "key": "value",
    "anotherKey": "anotherValue"
  }
}

API Store Endpoints

These endpoints allow you to view product options, values and their metadata within your Medusa project.

List All Options for a Product

Endpoint:

GET /store/products/{productId}/options

Description: Retrieves all options for a specified product.

Parameters: productId: The ID of the product.

Get a Specific Option for a Product

Endpoint:

GET /store/products/{productId}/options/{optionId}

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option.

Get all Values of a Specific Option for a Product

Endpoint:

GET /store/products/{productId}/options/{optionId}/values

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option.

Get a Specific Value of a Specific Option for a Product

Endpoint:

GET /store/products/{productId}/options/{optionId}/values/{valueId}

Description: Retrieves a specific option for a specified product.

Parameters: productId: The ID of the product. optionId: The ID of the product option. valueId: The id of the value option

Example Usage

To update the metadata for a specific product option, send a POST request to the /admin/products/{productId}/options/{optionId} endpoint with the new metadata in the request body.

bash

curl -X POST http://your-medusa-url/admin/products/123/options/456 \
-H "Content-Type: application/json" \
-d '{
"metadata": {
	"color": "red",
	"size": "M"
}
}'

To view the metadata for a specific product option, send a GET request to the /store/products/{productId}/options/{optionId} endpoint with the new metadata in the request body.

bash

curl -X GET http://your-medusa-url/store/products/123/options/456 \
-H "Content-Type: application/json" \

Visit the Quickstart Guide to set up a server.

Visit the Docs to learn more about our system requirements.

What is Medusa

Medusa is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any product that needs foundational commerce primitives. All modules are open-source and freely available on npm.

Learn more about Medusa’s architecture and commerce modules in the Docs. Roadmap, Upgrades & Plugins

You can view the planned, started and completed features in the Roadmap discussion.

Follow the Upgrade Guides to keep your Medusa project up-to-date.

Check out all available Medusa plugins.

This setup allows for managing product options and their metadata effectively within your Medusa project.

Community & Contributions

The community and core team are available in GitHub Discussions, where you can ask for support, discuss roadmap, and share ideas.

Join our Discord server to meet other community members. Other channels

GitHub Issues
Twitter
LinkedIn
Medusa Blog