Jump to content
Sign in to follow this  
Cloud is My Home

How to get Order ID using Invoice ID

Recommended Posts

Hello,

I wanted to get the Order ID using the invoice ID with API (Internal) or with by Interacting with the database

I would love it if someone helps me with this.

 

Thanks!

Share this post


Link to post
Share on other sites

This query provides Order ID and Order Number using Invoice ID as input parameter.

SELECT id, ordernum FROM tblorders WHERE invoiceid = '{YOUR_INVOICE_ID}' LIMIT 1

Share this post


Link to post
Share on other sites
4 hours ago, Cloud is My Home said:

But I was wondering how can I achieve using Capsule 

the capsule equivalent would be...

$orderid = Capsule::table('tblorders')->where('invoiceid','{YOUR_INVOICE_ID}')->value('id');

if you wanted ordernum instead, you would change ->value('id') to ->value('ordernum')

Share this post


Link to post
Share on other sites
On 7/23/2019 at 10:47 AM, brian! said:

the capsule equivalent would be...


$orderid = Capsule::table('tblorders')->where('invoiceid','{YOUR_INVOICE_ID}')->value('id');

if you wanted ordernum instead, you would change ->value('id') to ->value('ordernum')

This worked just fine, Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated