How a product's price is determined
The final price of a product, the price a customer pays, can be affected by a large range of different features and functionality enabled on your ShopWired account or otherwise used by ShopWired in calculations. The process of calculating the final price of a product is complex and involves multiple different pricing systems, discounts, and other types of adjustments.
There are 3 main points at which product prices are displayed during a customer's journey:
- Before a product is added to the basket (e.g. on category/search pages, the product page)
- When the product is added to the basket
- Once a customer has successfully completed an order
Most price calculations occur in the basket system, which determines the price a visitor will pay for the product when completing their order. However, some calculations occur after the order in the order system.
Price calculations are a complex topic. This help guide provides an explanation of how ShopWired determines the final price for a product, taking into account all of the different price modifiers that are available on ShopWired.
Definitions
- Basket system is the internal set of algorithms ShopWired uses to calculate the price of a product when it's in a visitor's basket
- Basket item is a single quantity of a specific product in the visitor's shopping basket
- Order system is the internal set of algorithms ShopWired uses to make small adjustments to the price of a product after an order
- Order item is a single quantity of a specific product in a customer's order
- Base price is the initial VAT-exclusive price of a basket item, calculated as either the sale price or a custom price
Price calculation
The basket system is responsible for determining the price of a basket item. The steps are as follows:
-
If a custom price is set for the basket item, this becomes the base price, and all subsequent price calculations are bypassed.
-
If no custom price is set, the sale price is determined as the base price. This is calculated in the following order:
- Trade pricing:
- Trade prices
- Trade pricing band prices
- The product or variation cost price multiplied by the cost price multiplier
- Trade global price discounts
- Other sale pricing:
- A
- A sale
-
If the basket item is a gift card, the value selected by the visitor is used as the base price.
-
If the product has product extras or product choices, their prices are added to the base price unless a custom price is set.
The base price is adjusted further by applying bulk prices or bulk discounts, which override the sale price and become the new base price.
VAT rate determination
After the base price is established, the basket system determines the appropriate VAT rate for the basket item. The VAT rate is determined based on the following order of precedence:
- If disability VAT relief applies, the VAT rate is set to zero
- If an already selected delivery zone has a configured VAT rate
- If an item is in the basket as a result of an and there is a custom VAT rate
- Custom VAT rates for products, variation combinations, or gift cards
- If no custom VAT rates apply, the VAT rate is determined by:
- The VAT rate of the shipping country or country selected by the visitor
- Your ShopWired account's VAT rate
- Either a custom VAT rate for your location or,
- Your location's standard VAT rate (e.g. 20% for the UK)
Discount application and order of precedence
ShopWired applies discounts and offers to the base price in a specific order:
- Product bulk pricing
- Product bulk discounts
- Offers
- Referral system discounts
- Multi-buy offers
- Vouchers
- Reward points redemption discounts
Discounts like bulk pricing and bulk discounts are injected directly into the base price, making them part of the new price going forward. Other discounts, such as vouchers, referral discounts, and reward points, are applied separately and do not modify the base price.
Price adjustments and discount applications
After determining the VAT rate and applying discounts, ShopWired adjusts the price using the following rules:
- If a visitor is from a and VAT equivalent pricing is activated on your ShopWired account, the VAT equivalent amount is added to the price using either the basket item VAT rate or your ShopWired account's VAT rate
- If you are entering prices including VAT, and the original VAT rate of the product is different from the current (basket item) VAT rate, ShopWired adjusts the final price by:
- Adding VAT based on the original VAT rate
- Subtracting VAT based on the current VAT rate
ShopWired also supports calculating prices including or excluding discounts. Discounts like subscription discounts and multi-buy offers are injected into the price calculation.
Basket item and order item differences
Basket items and order items differ in how their prices are calculated and stored:
- A basket item is a dynamic object whose values are recalculated as adjustments and discounts are applied
- An order item stores static values based on the basket item’s final price, VAT, total, and total VAT at the time the order is created
Basket item totals and rounding
Once the base price and VAT are determined, ShopWired calculates the following for each basket item:
- Basket item price (VAT exclusive): Computed using the formula
round(price + VAT, 2) - round(VAT, 2)
- Basket item VAT: Rounded to two decimal places
These values are then used to calculate:
- Basket item total: Usually
price * quantity
, adjusted for features like alternative product choice pricing - Basket item total VAT: Usually
VAT * quantity
, adjusted similarly to the total
Both totals are rounded to two decimal places.
VAT calculation
If you have selected to calculate VAT on the total quantity of a line item, the following additional steps are performed:
- The basket item gross is calculated as
round(price + VAT, 2)
- The line item gross is calculated as
basket item gross * quantity
- If alternative product choice pricing is enabled, adjustments are made to the line item gross
- The line item VAT is calculated based on the line item gross and rounded to two decimals
- The line item total is calculated as
line item gross - line item VAT
- If alternative product choice pricing is not enabled, the basket item price and VAT are re-computed by dividing the line item values by quantity
Verifying the price of a product or line item in an order
Verifying the price of a product or line item in an order
If you’d like to understand how the price of a product or line item in an order was calculated, follow these steps:
Step 1: Check the base price
- Determine if a custom price was applied to the product:
- A custom price might be set in the admin system, through a , or using a website feature (e.g., the
custom_price
POST parameter through theme coding) - If a custom price exists, this becomes the base price, and no further price modifications (e.g., product extras, discounts) are applied
- A custom price might be set in the admin system, through a , or using a website feature (e.g., the
- If no custom price exists, the sale price is used as the base price. The sale price is determined in the following order:
- Trade pricing:
- Trade prices
- Trade pricing band prices
- The product or variation cost price multiplied by the cost price multiplier
- Trade global price discounts
- Other sale pricing:
- A
- A sale
Step 2: Include product extras and product choices
- If the product has product extras or product choices, their prices are added to the base price unless a custom price was applied
Step 3: Consider product bulk prices and product bulk discounts
- Check if bulk prices or bulk discounts were applied:
- Bulk prices and discounts replace the base price and are treated as custom prices moving forward
Step 4: Verify VAT rates
The VAT rate applied to the product is determined in the following order:
- If disability VAT relief applies, the VAT rate is zero
- Custom VAT rates for the product, attributes, or gift vouchers
- The VAT rate of the shipping country or the country selected by the visitor
- Your ShopWired account's VAT rate
Step 5: Review discounts
Discounts are applied in the following order:
- Product bulk pricing
- Product bulk discounts
- Offers
- Referral system discounts
- Multi-buy offers
- Vouchers
- Reward points redemption discounts
- Some discounts, such as bulk prices and bulk discounts, are injected into the base price. Others, such as referral scheme discounts and vouchers, are applied separately
Step 6: Rounding Adjustments
- Ensure rounding adjustments are applied:
- Basket item price (VAT exclusive): Computed using the formula
round(price + VAT, 2) - round(VAT, 2)
- Basket item VAT: Rounded to two decimal places
- Totals and VAT amounts are rounded to two decimals
Example Calculation
Product base price: £50.00
- Product extras: £10.00
- Bulk discount: -£5.00
- VAT rate: 20%
- Referral scheme discount: -£3.00
Step-by-step Calculation:
- Base price (including extras):
£50.00 + £10.00 = £60.00
- Bulk discount applied:
£60.00 - £5.00 = £55.00
- VAT applied:
£11.00
- Referral scheme discount:
£55.00 - £3.00 = £52.00
Final Price (VAT inclusive): £52.00 + £11.00 = £63.00
Use these steps to verify the final price of any product or line item.