Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
How to retrieve localstorage data into woocommerce order database with using nextjs?

I am trying to retrieve data from the local storage if I am trying with hardcoded data that is retrieved at woo-commerce order list but if I am trying to retrieve from local storage that is not retrieved. Is there any other way to fetch the local storage data?


const WooCommerceRestApi = require("@woocommerce/woocommerce-rest-api").default;

const api = new WooCommerceRestApi({
    url: process.env.NEXT_PUBLIC_WORDPRESS_SITE_URL,
    consumerKey: process.env.CONSUMER_KEY,
    consumerSecret: process.env.CONSUMER_SECRET,
    version: "wc/v3"
});
export default async function handler(req, res){
    const responseData = {
        success:false,
        orders: []
    }

    const { perPage} = req?.query ?? {};
    const data = localStorage.getItem('woo-next-cart', event.target.value);

    try {
         api.post(
            'orders',data,
            {
                per_page:perPage||10
            }
        );
        responseData.success = true;
        responseData.orders = data;
        res.json( responseData);
    } catch ( error ){
        responseData.error = error.message;
        res.status(500).json(responseData);
    }
}  
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!