Skip to content

Commit 2348303

Browse files
authored
Merge pull request #4 from Foxy/feat/customizable-price-field
feat(customization): allows users to customize the Webflow price field
2 parents 9170817 + f6a04ef commit 2348303

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/functions/pre-payment-webhook-webflow/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ This step is optional.
7070

7171
You may have some items you don't want to be subject to price verification. This is the case, for example, for donations and gift cards where the user may be expected to customize the price.
7272

73-
| Variable | Default Value | Description |
74-
| ------------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
75-
| FX_SKIP_PRICE_CODES | "" | A comma separated list of code values (this is the value set in your 'code' field in Webflow or in the field you set with `code_field` parameter. **The items with these codes will skip price verification**. |
76-
| FX_SKIP_INVENTORY_CODES | "" | A comma separated list of code values (this is the value set in your 'code' field in Webflow or in the field you set with `code_field` parameter. **The items with these codes will skip inventory verification**. |
77-
| FX_FIELD_CODE | "code" | The name of the field that stores the code in the webflow collection. |
78-
| FX_FIELD_INVENTORY | "inventory" | The name of the field that stores the inventory in the webflow collection. Set this variable to "false" (without the quotes) to disable inventory verification for all items. |
73+
| Variable | Default Value | Description |
74+
| ------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
75+
| FX_SKIP_PRICE_CODES | "" | A comma separated list of code values (this is the value set in your 'code' field in Webflow or in the field you set with `code_field` parameter. **The items with these codes will skip price verification**. |
76+
| FX_SKIP_INVENTORY_CODES | "" | A comma separated list of code values (this is the value set in your 'code' field in Webflow or in the field you set with `code_field` parameter. **The items with these codes will skip inventory verification**. |
77+
| FX_FIELD_CODE | "code" | The name of the field that stores the code in the webflow collection. |
78+
| FX_FIELD_PRICE | "price" | The name of the field that stores the price in the webflow collection. |
79+
| FX_FIELD_INVENTORY | "inventory" | The name of the field that stores the inventory in the webflow collection. Set this variable to "false" (without the quotes) to disable inventory verification for all items. |
7980

8081
##### Error messages
8182

src/functions/pre-payment-webhook-webflow/pre-payment-webhook-webflow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ function isPriceCorrect(comparable) {
265265
const fxItem = comparable.fxItem;
266266
if (
267267
!fxItem // an item with no matched item is not to be checked
268-
|| customOptions().skip.price.indexOf(wfItem[getCustomKey('code')]) >=0
268+
|| customOptions().skip.price.indexOf(iGet(wfItem, getCustomKey('code'))) >=0 // items with price set to be skipped are not to be checked
269269
) {
270270
return true;
271271
} else {
272-
return parseFloat(fxItem.price) === parseFloat(iGet(wfItem, 'price'));
272+
return parseFloat(fxItem.price) === parseFloat(iGet(wfItem, getCustomKey('price')));
273273
}
274274
}
275275

0 commit comments

Comments
 (0)