medusa-product-helper 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +180 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,186 @@
34
34
 
35
35
  ## Compatibility
36
36
 
37
- This starter is compatible with versions >= 2.4.0 of `@medusajs/medusa`.
37
+ This plugin is compatible with versions >= 2.4.0 of `@medusajs/medusa`.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ yarn add medusa-product-helper
43
+ # or
44
+ npm install medusa-product-helper
45
+ ```
46
+
47
+ ## Configuration
48
+
49
+ Add the plugin to your `medusa-config.ts`:
50
+
51
+ ```ts
52
+ import type { ConfigModule } from "@medusajs/framework/types"
53
+
54
+ const plugins = [
55
+ {
56
+ resolve: "medusa-product-helper",
57
+ options: {
58
+ // Metadata descriptors for product metadata fields
59
+ metadata: {
60
+ // Expose client-side helper functions for metadata access
61
+ expose_client_helpers: true,
62
+ // Define metadata fields that will be used across products
63
+ descriptors: [
64
+ {
65
+ key: "brand",
66
+ label: "Brand",
67
+ type: "text",
68
+ },
69
+ {
70
+ key: "material",
71
+ label: "Material",
72
+ type: "text",
73
+ },
74
+ {
75
+ key: "warranty_years",
76
+ label: "Warranty (Years)",
77
+ type: "number",
78
+ },
79
+ {
80
+ key: "is_eco_friendly",
81
+ label: "Eco Friendly",
82
+ type: "bool",
83
+ },
84
+ {
85
+ key: "certification_file",
86
+ label: "Certification Document",
87
+ type: "file",
88
+ },
89
+ ],
90
+ },
91
+ // Predefined price ranges for filtering
92
+ price_ranges: [
93
+ {
94
+ label: "Under $50",
95
+ currency_code: "usd",
96
+ min: 0,
97
+ max: 50,
98
+ },
99
+ {
100
+ label: "$50 - $100",
101
+ currency_code: "usd",
102
+ min: 50,
103
+ max: 100,
104
+ },
105
+ {
106
+ label: "$100 - $200",
107
+ currency_code: "usd",
108
+ min: 100,
109
+ max: 200,
110
+ },
111
+ {
112
+ label: "Over $200",
113
+ currency_code: "usd",
114
+ min: 200,
115
+ max: null,
116
+ },
117
+ {
118
+ label: "Custom Range",
119
+ min: null,
120
+ max: null,
121
+ },
122
+ ],
123
+ // Default price range when none is specified
124
+ default_price_range: {
125
+ label: "custom",
126
+ min: null,
127
+ max: null,
128
+ },
129
+ // Promotion window configuration
130
+ promotion_window: {
131
+ // Metadata key that stores the promotion start date
132
+ start_metadata_key: "promotion_start",
133
+ // Metadata key that stores the promotion end date
134
+ end_metadata_key: "promotion_end",
135
+ // If true, promotions without an end date are considered active
136
+ treat_open_ended_as_active: true,
137
+ },
138
+ // Product availability filtering options
139
+ availability: {
140
+ // Only show products that are in stock
141
+ require_in_stock: false,
142
+ // Include products available for preorder
143
+ include_preorder: true,
144
+ // Include products available for backorder
145
+ include_backorder: true,
146
+ // Include gift cards in product listings
147
+ include_gift_cards: false,
148
+ // Only show publishable products
149
+ publishable_only: true,
150
+ },
151
+ // Product rating configuration
152
+ rating: {
153
+ // Enable rating-based filtering
154
+ enabled: true,
155
+ // Minimum rating value (0-5)
156
+ min: 0,
157
+ // Maximum rating value (0-5)
158
+ max: 5,
159
+ // Require products to have at least one review
160
+ require_reviews: false,
161
+ },
162
+ },
163
+ },
164
+ ]
165
+
166
+ export default {
167
+ projectConfig: {
168
+ // Your Medusa project configuration
169
+ // database_url: process.env.DATABASE_URL,
170
+ // ...
171
+ },
172
+ plugins,
173
+ } satisfies ConfigModule
174
+ ```
175
+
176
+ ### Configuration Options
177
+
178
+ #### Metadata
179
+
180
+ Define metadata fields that will be used across your products. Available field types:
181
+ - `text`: String values
182
+ - `number`: Numeric values
183
+ - `bool`: Boolean values
184
+ - `file`: File references
185
+
186
+ #### Price Ranges
187
+
188
+ Define predefined price ranges for filtering. Each range can specify:
189
+ - `label`: Display label for the range
190
+ - `currency_code`: Optional ISO 3-letter currency code (e.g., "usd", "eur")
191
+ - `min`: Minimum price (null for no minimum)
192
+ - `max`: Maximum price (null for no maximum)
193
+
194
+ #### Promotion Window
195
+
196
+ Configure how promotion dates are tracked using product metadata:
197
+ - `start_metadata_key`: Metadata key storing promotion start date
198
+ - `end_metadata_key`: Metadata key storing promotion end date
199
+ - `treat_open_ended_as_active`: If true, promotions without an end date are considered active
200
+
201
+ #### Availability
202
+
203
+ Control which products appear in listings:
204
+ - `require_in_stock`: Only show in-stock products
205
+ - `include_preorder`: Include preorder products
206
+ - `include_backorder`: Include backorder products
207
+ - `include_gift_cards`: Include gift cards
208
+ - `publishable_only`: Only show publishable products
209
+
210
+ #### Rating
211
+
212
+ Configure rating-based filtering:
213
+ - `enabled`: Enable rating filtering
214
+ - `min`: Minimum rating (0-5)
215
+ - `max`: Maximum rating (0-5)
216
+ - `require_reviews`: Require at least one review
38
217
 
39
218
  ## Getting Started
40
219
 
@@ -42,8 +221,6 @@ Visit the [Quickstart Guide](https://docs.medusajs.com/learn/installation) to se
42
221
 
43
222
  Visit the [Plugins documentation](https://docs.medusajs.com/learn/fundamentals/plugins) to learn more about plugins and how to create them.
44
223
 
45
- Visit the [Docs](https://docs.medusajs.com/learn/installation#get-started) to learn more about our system requirements.
46
-
47
224
  ## What is Medusa
48
225
 
49
226
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusa-product-helper",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",