So, silly question. Why couldn't a job run against the database that scans the basket tables and compares the prices of the products in active baskets to the latest price of the product? Obviously it would need to take in account volume and price group calculations, but that does not seem like it would be too much stress on the database. This could happen as a scheduled task that we could control via the admin. Just a thought as this would solve a bunch of issues for us. We keep losing money as prices increase when we cannot manually update the carts.
--Scott
Announcement
Collapse
No announcement yet.
Cart Prices Should Auto-Update When Prices Change On Site
Collapse
X
-
There are many customers who use various price manipulation strategies that impact the price of something in a basket. If it was as simple as the basket price = product price this would be an easy and safe feature to implement - but that's not the case. Recreating the price in the basket based on a product change would require knowledge of every single step that created that basket price in the first place, and that isn't knowable.
if we were to implement something here, the likely solution would be to leave an item in the basket as a reference but with a "see product page for latest pricing" note allowing the customer to re-add it.
Leave a comment:
-
This really is an important feature that Miva should incorporate. We have a hyper seasonal business with over 1000 products available, and customers tend to build a list in their shopping cart over the course of a week to a month, and then finally check out. We saw substantial cost increases during the pandemic, and it was painful to have to try to keep up with all the carts manually. Perhaps Miva could take Colin's code, add the capability he didn't, and fully test, implement, and deploy this functionality natively. I have to ask myself, "Why wouldn't the price in the cart update when it's updated on the product page?" It should, and it does for large retailers.
Leave a comment:
-
Thanks for that Colin. I think before I go into creating something like this for myself, I want to see what Miva can do in their code. For now, we are just editing carts manually, which is really not fun. THis code makes sense though. Thank you again!
--Scott
Leave a comment:
-
This is just an augmentation of the orig example provided by Brannan. It is also not tested but should be close. I just felt like adding this in. Read the notes in the comments to understand what's going on and the warning/notes!! I assume no responsiblity for anything. Use at own risk and test on dev site using multitude of different products before deploying on a live site!
Code:<mvt:comment> * IMPORTANT!! * Use at your own risk!! Code does not account for any: * discounts inc volume pricing, * special variant pricing, * variants, * combined price of attributes changing * etc. It also does not account for removing the product from the cart if it no longer exists This is just an augmentation of the orig example provided by Brannan. It is also not tested but should be close. I just felt like adding this in. Put this code on any page I guess... but most likely checkout and/or basket pages. </mvt:comment> <mvt:assign name="l.settings:basketcontents" value="g.basket:groups" /> <mvt:assign name="l.settings:ttl_automatically_updated_items_i n_cart" value="0" /> <mvt:foreach iterator="group" array="basketcontents"> <mvt:comment>Load product as it is right now, Runtime means only Active products</mvt:comment> <mvt:do name="l.loadedProductOK" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:group:current_product_values )" /> <mvt:comment>Product is not active, continue to next item.</mvt:comment> <mvt:if expr="l.loadedProductOK NE 1"> <mvt:foreachcontinue/> </mvt:if> <mvt:comment>If cart product price is the same as product price continue to next item. See * IMPORTANT!! * note above</mvt:comment> <mvt:if expr="l.settings:group:price EQ l.settings:product:price"> <mvt:foreachcontinue/> </mvt:if> <mvt:comment>Product prices are not the same. Fix the cart item price automatically via API.</mvt:comment> <mvt:do file="g.Module_Library_DB" name="l.BasketItem_Load_LineOK" value="BasketItem_Load_Line(l.settings:group:baske t_id, l.settings:group:line_id, l.settings:group:loaded_basketitem)" /> <mvt:if expr="l.BasketItem_Load_LineOK NE 1"> <mvt:comment>Failed to load basket line id...</mvt:comment> <mvt:foreachcontinue/> </mvt:if> <mvt:comment>Set basket item price value variables to that of the product (you could set them all if you wanted to I guess)</mvt:comment> <mvt:assign name="l.settings:group:loaded_basketitem:price" value="l.settings:group:current_product_values:pri ce" /> <mvt:assign name="l.settings:group:loaded_basketitem:retail" value="l.settings:group:current_product_values:ret ail" /> <mvt:assign name="l.settings:group:loaded_basketitem:base_pric e" value="l.settings:group:current_product_values:bas e_price" /> <mvt:do file="g.Module_Library_DB" name="l.BasketItem_Update_PricingOK" value="BasketItem_Update_Pricing(l.settings:group: loaded_basketitem)" /> <mvt:if expr="l.BasketItem_Update_PricingOK"> <mvt:assign name="l.settings:ttl_automatically_updated_items_i n_cart" value="l.settings:ttl_automatically_updated_items_ in_cart + 1" /> </mvt:foreach> <mvt:comment>Regenerate Basket Discounts if we updated any of the items in the cart</mvt:comment> <mvt:if expr="l.settings:ttl_automatically_updated_items_i n_cart GT 0"> <mvt:do file="g.Module_Feature_PGR_RT" name="l.settings:Runtime_Discount_BasketOK" value="Runtime_Discount_Basket(g.basket)" /> </mvt:if> <mvt:comment>You might need to do something else too if you're not seeing correct basket total prices.</mvt:comment>
Leave a comment:
-
in semi pseudo code:
take what Brennan wrote and add:
<mvt:foreach iterator="group" array="basket:groups">
<mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:product )" />
<mvt:if expr="l.settings:group:price NE l.settings:product:price">
Item: &mvte:group:code; Price has changed!
<remove product> // addition
<add product> // addition
</mvt:if>
</mvt:foreach>
Leave a comment:
-
Originally posted by Brennan View PostIts fairly uncommon for Merchants to have a basket expiration open for a year. Finding a way to leverage wishlist, or Save basket for later may be a good long term solution here. But we've had others who have similar scenarios for various business reasons.
You can identify items in the cart where price does not match that of the price of the product record using this template code:
Code:<mvt:foreach iterator="group" array="basket:groups"> <mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:product )" /> <mvt:if expr="l.settings:group:price NE l.settings:product:price"> Item: &mvte:group:code; Price has changed! </mvt:if> </mvt:foreach>
--Scott
Leave a comment:
-
Its fairly uncommon for Merchants to have a basket expiration open for a year. Finding a way to leverage wishlist, or Save basket for later may be a good long term solution here. But we've had others who have similar scenarios for various business reasons.
You can identify items in the cart where price does not match that of the price of the product record using this template code:
Code:<mvt:foreach iterator="group" array="basket:groups"> <mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:product )" /> <mvt:if expr="l.settings:group:price NE l.settings:product:price"> Item: &mvte:group:code; Price has changed! </mvt:if> </mvt:foreach>
Leave a comment:
-
Hey Bruce! Unfortunately, that will not work for us as most of our clients are old school pinball repair guys that are not the best at computers. :) I was just in a little bit of shock when we discovered this.
--Scott
Leave a comment:
-
I am not positive, but i believe if you tell clients to save it to a list, and then they come back three months later and "add" the list to the cart, the prices reflected will be current.
Ideal? maybe not, but may be wise to do so you don't need to 1) keep baskets open for a year 2) make people 'dump' their basket cause they have an immediate need for one product.
Leave a comment:
-
Cart Prices Should Auto-Update When Prices Change On Site
So here is an interesting one. We change our pricing very frequently to ensure our customers get the best price possible and that we do not lose money when costs change. Pretty standard business stuff. Well, we have a clientele that loves to build long lists of parts they need in there carts, so we do not expire carts for 365 days. I was unaware of this until recently, but carts will never fully recalculate to the current prices of an item if the price has changed. We have lost a bunch of money because of this as we keep our prices really tight to a specific margin. Right now there is no straight forward workaround for this besides expiring the carts much faster, but that is not possible for us.
I would love if the carts could refresh when the customer views it or starts their actual checkout process. This honestly just seems like more of a bug than anything.
--ScottTags: None
- 1 like
Leave a comment: