question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calculated prices per item and not order

See original GitHub issue

Is your feature request related to a problem? Please describe. The prices won’t be displayed to the customers before they add it to the cart.

Describe the solution you’d like I will like to show them if a certain product is on sale, or if eg. a product is cheaper if the customer would bulk buy. Like eg: Item A is on sale for 20%. 1 for 20. Or buy 5 for 15/piece This would lead to better sell. Technically it would be nice to have salesPrice in the item. Maybe with configuration where you can customize the calculation of the price. There will in my case be: Discount for an item as % or fixed price. Discount for a customer group as % or fixed price. Discount for a customer within price group as fixed price. Discount for a customer within discount group as %.

Calculation in short:

  1. Take the lowest possible fixed price.
  2. Take the lowest possible % discount.
  3. Add % discount to the fixed price.

Describe alternatives you’ve considered I’ve disabled the default price field on productVariant and added custom price which includes default price and salesPrice. In the salesPrice, it would pull ALL promotions, and then filter them, and then calculate. Imagine doing this for every products in a queried list of products. This slows down the query pretty much. It is also a problem for ordering, as the price is in a custom field.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelbromleycommented, Feb 28, 2022

@HarunKilic ok so if I understand correctly, in this way you’ll be pre-calculating the bulk prices ahead of time. If so, that’s a smart way to do it - you can put that work on the worker process and just let it run. Then you’ll incur zero performance cost at query time.

@dominikager this strategy sounds fine for the product detail page, assuming you do not have hundreds of variants being calculated at once.

0reactions
dominikagercommented, Feb 26, 2022

@HarunKilic we also need the discount on the Item and not on the Order. We are thinking about implementing a “getSalePrice” Query. This will have the country, customer, and product as arguments. Based on that we can directly show the correct price on the Product Detail page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Calculate Cost Per Order for Your Ecommerce Store
To calculate cost per order, you first need to add up all of your order expenses — everything you spend to acquire, fulfill,...
Read more >
How to Calculate and Compare Unit Prices at the Store: 8 Steps
1. Check the item’s total price. The unit price is typically a fraction of the total cost of the product. Look at the...
Read more >
How to Price A Product in 3 Simple Steps (2023) - Shopify
Your selling price needs to be able to keep you in business. If products are set at a high price and potential customers...
Read more >
Restaurant Menu Pricing: How to Price a Menu For Profit
The complete equation will be as follows: $14.29 (Price) = $4.00 (Raw Food Cost of Item) / 28% (Ideal Food Cost Percentage). The...
Read more >
How to Calculate Fulfillment Cost Per Order
Calculating Fulfillment Cost Per Order · Total warehouse cost per order – total warehouse costs divided by annual orders shipped. · Total warehouse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found