Configuration transfer and contradictions
Moving a store's configuration as a document, and finding the settings that disagree with each other.
Two moves behind kahunacart.settings: carrying a store's configuration out as a JSON document and applying one back, and reading which of this store's settings are each valid on their own and wrong together. The command line has the same pair as config:export and config:import. See Configuration and CLI.
Import a store configuration
/api/v1/kahunacart/config/import
Apply a configuration export: the plugin's YAML, plus whichever of the tax zones and rates, shipping zones, methods and collection points, coupons, campaigns, sales, settings rows and saved views the document carries. The whole document is checked before anything is written, then applied in one transaction. Importing the same document twice leaves the store exactly as importing it once did. Set dry_run to find out what it would do without writing anything. Sections the document does not carry are left alone.
Parameters
| Name | Type | Description |
|---|---|---|
| document required | object | The export document, as written by bin/plugin kahunacart config:export |
| dry_run optional | boolean |
Report the plan and write nothing at all
Default:
false |
Settings that disagree with each other
/api/v1/kahunacart/config/contradictions
Settings that are each valid on their own but wrong together: prices marked as including tax when no tax rate is set, tax-inclusive prices with delivery left untaxed, or checkout still on after the basket was turned off. Each result names the settings involved, what they are set to now, and what the one-click fix would write. Every rule is returned whether or not it fires, so a screen can say plainly that nothing disagrees.
Fix a contradiction
/api/v1/kahunacart/config/contradictions/apply
Write one rule's recommended values into the store's own configuration file. The values are merged in, so everything else in the file is kept. Returns the contradictions that are still left.
Parameters
| Name | Type | Description |
|---|---|---|
| code required | string | A rule code from detect_config_contradictions, e.g. tax_inclusive_without_a_rate |
Export the store configuration
/api/v1/kahunacart/config/export
The store's configuration as a JSON document the browser saves: the plugin's YAML, the settings table, tax, shipping, promotions and saved views. ?include= and ?exclude= take comma-separated section names. Secrets leave as $KAHUNACART_* environment references and never as values. No tool: it serves a file rather than a payload, and what a model wants from a store's configuration is the settings, which it can read through the tools that publish them
An export document holds the plugin's YAML, the settings table, tax, shipping, promotions and saved views, and ?include= and ?exclude= take comma-separated section names when you want a slice of that. A secret leaves as a $KAHUNACART_* environment reference and never as a value, so a document is safe to commit and lands in the next store reading that store's own variables.
An import is validated end to end before anything is written and applied inside one transaction, so a document that is wrong halfway through leaves the store exactly as it found it. Send dry_run: true first: it opens no transaction, touches no file, and answers with the plan.
The contradiction check publishes every rule whether or not it fires, so a screen can say "nothing here disagrees" with the same confidence it names a problem. Applying one writes that rule's recommended values merged into the merchant's own configuration file rather than written over it.