Hi, I'm kind of new to extensions. I would like to...
# suitecommerce
r
Hi, I'm kind of new to extensions. I would like to know if there's a way to be able to change the value of an object in the model itself. For example, replacing/overriding the item price.
k
@Raen, is your intention to change the item price and have it saved into the Item record or just change the price displayed to the customer on the webstore?
r
@Keith Fetterman I just need to be able to change the item price displayed, but it needs to be all throughout the site. so when I add it into the cart, it should also reflect the new price in the cart confirmation modal, cart view and checkout.
k
It’s possible, but not easy. It requires some complex programming that will involve using scriptable cart and possibly working directly with the commerce api and replacing the pricing data returned from Item Search API with your own pricing.
Th extensibility API doesn’t support it.
Can you do it with pricing levels? If so, you could do it using the extensibility api and other standard functionality.
r
we're already using price levels and that's exactly what I need. upon selection of a date range, it will determine the corresponding price level. so what I'm trying to do is to reflect the corresponding price based on that.
but I'm not able to find a way on how to be able to do so. currently, I'm only able to reflect it physically but it only gets applied on PDP and Quick View. I can't think of any way of being able to apply it to the other views as well that have the item price
k
The price level is displayed when a customer is logged in. When a customer is logged into the site, are you not seeing the correct price for the customer’s price level?
r
we have an extension for rentals. so it's based on the date range selected and each duration has a specific price level. like daily or weekly. so I'm able to pull the corresponding price based on the price level set for the duration selected.
now the problem is to be able to set that price as the new price for the item
k
Is the price level that you are mentioning the same thing as the standard item multiple price levels feature in NetSuite. I don’t understand how you are are associating price level with duration. The standard feature consists of an item having multiple price levels. A specific price level is associated with a customer. When customer comes to the website they see the default price level until they log in. When they log in, they see their price level if a price level is set in their customer record and the item has a price at that price level.
r
yes, it is the standard price level feature in NetSuite. the extension has this functionality of having a start and end date for renting out the item in the PDP/QuickView. so once the duration is calculated, I pull all the price levels that are mapped out for each duration we have (there's a configuration record for this). that's how I use and get the corresponding price.
k
I don’t see how this use case of price levels isn’t going to work. The price level that you want displayed has to be set for the logged in customer. There is no way to dynamically change logged in customer’s price level.
One way to do it is to overwrite the price that is returned from Item Search API each time the product is displayed. When the item is added to the cart, the custom price would need to stored in the cart custom field then a scriptable cart script would extract the price from the custom field and set it as the rate for the cart item.
r
The aim is to actually override the set price for the webstore and the price set on the customer. I'm just pulling the list/configuration record where the duration (daily, weekly, etc) is mapped out to its corresponding price level. then in the PDP, one the end date is selected, I pick out the corresponding price level in that list and hopefully display its price. I was able to do it in PDP and Quick View by using jquery to replace the displayed price, so it's just displayed and not really changed in the model.
I also customized the liveorder, I did the modification of the calculation in after:LiveOrder.get to be able to reflect the new computation and be able to display the new amount.
my only left issue is to be able to also display/reflect the new price in the other views since it's not really overriding the value of the item price in the model
k
To change the price of a cart item, you’ll need to use scriptable cart. To make the custom price available to the scriptable cart, you will need to pass it in via a custom transaction item field or item option field. These fields are available in the shopping section.
☝🏻 1
r
okay, I'll try to look into that. thank you very much!