shipping
x5engine.cart.shipping
Kind: global class
Summary: Describe a shipping method. Usually you don't want to directly instantiate this class but rather access to the instances created by WSX5 and stored in `x5engine.cart.manager`.
You may get them using `x5engine.cart.manager.shippings()`.
- shipping
- new shipping(settings)
- .base() ⇒
Object - .id() ⇒
String - .name() ⇒
String - .description() ⇒
String - .image() ⇒
String - .price(includeVat, weight, amount) ⇒
Number - .vat(weight, amount) ⇒
Number - .email() ⇒
String
new shipping(settings)
Create a new Shipping object.
| Param | Type | Description |
|---|---|---|
| settings | Object |
|
| settings.id | String |
The shipping id |
| settings.name | String |
The shipping name |
| settings.description | String |
The shipping description |
| settings.precision | Number |
The numbers precision |
| settings.vat | Number |
The VAT as % |
| settings.type | String |
The shipping type ("FIXED", "AMOUNT", "WEIGHT") |
| settings.price | Number |
The shipping price (Can be a number or an object, basing on the shipping type) |
| settings.email | String |
The shipping text to be shown in the customer's email |
| settings.image | String |
.base() ⇒ Object
Provide the base settings for this class
Kind: instance method of shipping
.id() ⇒ String
Provide the id of this shipping type
Kind: instance method of shipping
.name() ⇒ String
Provide the name of this shipping type
Kind: instance method of shipping
.description() ⇒ String
Provide the description of this shipping type
Kind: instance method of shipping
.image() ⇒ String
Get the image url of this shipping type
Kind: instance method of shipping
.price(includeVat, weight, amount) ⇒ Number
Return the price of this shipping
Kind: instance method of shipping
| Param | Type | Description |
|---|---|---|
| includeVat | Boolean |
True to include VAT |
| weight | Number |
The total weight of goods in the cart |
| amount | Number |
The total amount of goods in the cart |
.vat(weight, amount) ⇒ Number
Return the vat of this shipping
Kind: instance method of shipping
| Param | Type | Description |
|---|---|---|
| weight | Number |
The total weight of goods in the cart |
| amount | Number |
The total amount of goods in the cart |
.email() ⇒ String
Return the email text of this shipping
Kind: instance method of shipping