function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
❤Code❤Code 

Urgent plzz..shopping cart in vf page

Hi All,

Does anyone has any example for shopping cart / Add to cart functionality. Please share.

Regards
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi code,
I hope it will be helpful.

Best Regards
Rahul Kumar

 
Akshay_DhimanAkshay_Dhiman
Hi Code,
The following triggers and test class make up the shipping invoice example application:
Shipping Invoice Example Code:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_shopping_cart_example_code.htm

To save records try this:
for(PricebookEntry d : AvailableProducts){
           if((String)d.Id==toSelect){
               shoppingCart.add(new opportunityLineItem(OpportunityId=theOpp.Id, PriceBookEntry=d, PriceBookEntryId=d.Id, UnitPrice=d.UnitPrice, ));
               break;
           }
       }
       
       updateAvailableList();
If this answer(link) helps you then mark it as a solution.
Regards,
Akshay