Hey Everyone! Is there a way to modify the amount ...
# suitecommerce
z
Hey Everyone! Is there a way to modify the amount in the cart based on item option selection on the SCA Website ?
s
Well if it's a matrix child product, you just price it differently. Otherwise you would need to use scriptable cart.
z
No, it's not a matrix item. Yes I am using scriptable cart and i could use the recalc method to execute the script when item is added to the cart also i could change the item price on sales order but the problem is that i can't show the updated price on website which is critical in my case. If there is a way to display the updated price can i know about that ?
s
Where exactly are you trying to show the price?
z
on the sca website cart page
The 1st image is the list of option appearing on website that user can select and upon selection of options there should be increase in amount of item which should display on cart image 2 is for reference of cart where the updated amount should display.
s
Not sure I follow – are you saying that after using
nlapiSetCurrentLineItemValue()
to change the rate, it's not updating in the UI?
z
Earlier, we were working with Scriptable Cart, and the work was being done, but it was happening in NetSuite. However, we need the amount in the SCA website cart after the item option selection. So, can we accomplish this using Scriptable Cart, or is there another way to do it?
Are your talking about not updating on website UI or Netsuite UI ?
s
I'm struggling to understand what exactly is happening or what the problem is. Using scriptable cart, your code should be written so that it updates the rate of the line item when the option is selected.
This will then be shown on the line item in the cart and in the checkout.
So I don't understand what is not happening in your example. Does your code not update the price? Does the price update but it doesn't show?
As an aside, it sounds like you don't really understand how to do scriptable cart so you may wish to develop your skills with some of the examples we provide in the docs first to get to grips with it.
Alternatively, you may find more joy using something like the SC Gift Wrap & Message extension – I think you could repurpose this extension to do what you want to do.
You could set up your specialist delivery and installation options as 'gift wrap' and then offer them on the PDP, rebranding/renaming the fields to match your preferred language.
z
function customRecalc(type) { if (type == 'item') { // Correct condition check var itemId = nlapiGetCurrentLineItemValue('item', 'item'); // Get the current item price var currentPrice = nlapiGetCurrentLineItemValue('item', 'rate'); // Add $50 to the current price var newPrice = parseFloat(currentPrice) + 50; // Set the new price back to the item nlapiSetCurrentLineItemValue('item', 'rate', newPrice.toFixed(2)); // Log the new price for debugging nlapiLogExecution('DEBUG', 'Updated Item Price', 'Item ID: ' + itemId + ' | New Price: ' + newPrice); } return true; }
That's the script that i am using in scriptable cart. In the above code when item is added to the cart it should add $50 to the item amount but there is no change occuring neither on netsuite nor in SCA website.
s
I'm not going to debug your script, sorry. What I will say is that I spent about an hour mocking up specialist delivery using the gift wrap extension and it seems to work fine. So, might I suggest you try that.
z
It's done thank you so much for the help!
j
@Steve Goldberg can we achieve this thing natively without scriptable cart or without gift wrap item, with only item options?
s
Related items?
j
We want to achieve the following: We have items, both matrix and non-matrix, and all are "non-inventory for resale" items. On the product detail page, we need to display a list of different options, such as "Inside Delivery (Basic Threshold Delivery)," "Room of Choice (+$50)," and "Room of Choice, Unpack And Assembly (+$100)." For this, we have created an item option since these options include an additional charge of $50 and $100. When a customer selects one of these options and adds the item to the cart, the price of the selected item option should be added to the cart on the website. This is what we want to implement. See below image for reference
s
I'm aware of the requirement, I feel like I've already suggested a few things you can do: • Reuse the gift wrap extension • Matrix products • Scriptable cart • Related items
I would suggest that you use your initiative and pick one and go with it
j
okay thank you so much