-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,53 @@ | ||
Dynamictaxmode for Commerce | ||
------------------------ | ||
# Dynamic Tax Mode for Commerce | ||
|
||
This is an extension for modmore's [Commerce](https://modmore.com/commerce/). It does ... something really awesome ... and is available under the MIT License. | ||
|
||
This is an extension for modmore's [Commerce](https://modmore.com/commerce/). | ||
|
||
This module allows a product to switch between inclusive and exclusive tax modes during | ||
checkout based on a session variable, and provides a custom product type called DynamicTaxModeProduct | ||
that allows setting both normal pricing and business pricing. The pricing shown to the customer | ||
depends on the tax mode currently active for that product. | ||
|
||
It is available under the MIT License. | ||
|
||
Requirements: | ||
|
||
- Commerce 1.3+ | ||
- Commerce 1.5+ | ||
- PHP 7.4+ | ||
- ... other requirements .. | ||
|
||
To use, install the package from [the MODX|modmore package provider](.. link to extras page ..), and enable the module under Extras > Commerce > Configuration > Modules. | ||
To use, install the package from the [modmore package provider](https://modmore.com/about/package-provider/), and enable the module under Extras > Commerce > Configuration > Modules. | ||
|
||
## Detailed usage | ||
|
||
.. | ||
**Set the session key** | ||
|
||
The tax mode changes between `exclusive` and `inclusive` depending on a session value. The default | ||
key for the session variable is `commerce_dynamictaxmode`. If you would like to change it to something | ||
else, you can set it in the module configuration window. Commerce > Configuration > Modules. | ||
|
||
**Create products with business pricing** | ||
|
||
Create a new product with the type `DynamicTaxModeProduct`, or you could also edit a current product and | ||
change to that type. Click on the pricing tab and you'll see fields for both normal pricing and business | ||
pricing. Enter the prices and hit save. | ||
|
||
**Set the session variable** | ||
|
||
If no session variable is set, Dynamic Tax Mode Products will fall back to using the global system setting | ||
`commerce.tax_calculation`. | ||
|
||
Use your custom session key, or the default `commerce_dynamictaxmode`. The value should be set as either `inclusive` or `exclusive`. | ||
|
||
## Credits | ||
A basic snippet on a product page might be one way of setting the session variable. e.g. | ||
``` | ||
<?php | ||
$_SESSION['commerce_dynamictaxmode'] = 'inclusive'; | ||
return ''; | ||
``` | ||
|
||
.. | ||
**Public methods** | ||
|
||
## Support | ||
`DynamicTaxModeProduct` includes two public methods to assist with getting and saving business pricing programmatically: | ||
|
||
Please open an issue with feature requests or bug reports. If you need help setting up or customising Dynamictaxmode, [paid support is available](.. link to a support page or email ..). | ||
- getBusinessPricing(comCurrency $currency): ?ItemPricingInterface | ||
- saveBusinessPricing(ItemPricingInterface $pricing): bool |