Implemented Rollback Functionality
This commit is contained in:
49
README.md
49
README.md
@@ -49,9 +49,24 @@ TARGET_TAG=sale
|
||||
|
||||
# Price adjustment percentage (positive for increase, negative for decrease)
|
||||
# Examples: 10 (increase by 10%), -15 (decrease by 15%), 5.5 (increase by 5.5%)
|
||||
# Note: Only used in "update" mode, ignored in "rollback" mode
|
||||
PRICE_ADJUSTMENT_PERCENTAGE=10
|
||||
|
||||
# Operation mode - determines whether to update prices or rollback to compare-at prices
|
||||
# Options: "update" (default) or "rollback"
|
||||
# When not specified, defaults to "update" for backward compatibility
|
||||
OPERATION_MODE=update
|
||||
```
|
||||
|
||||
### Operation Mode Configuration
|
||||
|
||||
The `OPERATION_MODE` environment variable controls the application behavior:
|
||||
|
||||
- **`update` (default)**: Performs price adjustments using `PRICE_ADJUSTMENT_PERCENTAGE`
|
||||
- **`rollback`**: Sets prices to compare-at price values and removes compare-at prices
|
||||
|
||||
When `OPERATION_MODE` is not specified, the application defaults to `update` mode for backward compatibility.
|
||||
|
||||
### Getting Your Shopify Credentials
|
||||
|
||||
#### For Private Apps (Recommended):
|
||||
@@ -84,6 +99,36 @@ or
|
||||
node src/index.js
|
||||
```
|
||||
|
||||
### Operation Modes
|
||||
|
||||
The application supports two operation modes:
|
||||
|
||||
#### Update Mode (Default)
|
||||
|
||||
Adjusts product prices by a percentage:
|
||||
|
||||
```bash
|
||||
npm run update
|
||||
```
|
||||
|
||||
This performs the standard price adjustment functionality using the `PRICE_ADJUSTMENT_PERCENTAGE` setting.
|
||||
|
||||
#### Rollback Mode
|
||||
|
||||
Reverts prices by setting the main price to the compare-at price and removing the compare-at price:
|
||||
|
||||
```bash
|
||||
npm run rollback
|
||||
```
|
||||
|
||||
This is useful for reverting promotional pricing back to original prices. Products without compare-at prices will be skipped.
|
||||
|
||||
**Operation Mode Indicators:**
|
||||
|
||||
- The console output clearly displays which operation mode is active
|
||||
- Progress.md logs distinguish between "Price Update Operation" and "Price Rollback Operation"
|
||||
- Configuration summary shows the operation mode being used
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Before running the main script, you can use the debug mode to see what tags exist in your store and verify your target tag:
|
||||
@@ -278,7 +323,9 @@ shopify-price-updater/
|
||||
|
||||
## Available Scripts
|
||||
|
||||
- `npm start` - Run the main price update script
|
||||
- `npm start` - Run the price updater (defaults to update mode for backward compatibility)
|
||||
- `npm run update` - Run the price update script (explicitly set to update mode)
|
||||
- `npm run rollback` - Run the price rollback script (set prices to compare-at prices)
|
||||
- `npm run debug-tags` - Analyze all product tags in your store
|
||||
- `npm test` - Run the test suite (if implemented)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user