how do i add additional line items to a NetSuite order via API - suitescript2.0

our Shopify store syncs with NetSuite and we send orders with line items from Shopify to NS. However there are often situations where we need to enrich the orders in NS with zero value items that we don't want on the shopify order. E.g. marketing materials that we want to send out to the customer.
SuiteQL isn't an option as there is no way to add / update
SOAP API seems like a winner but good-god it's complicated
Could i build a complex rules engine in suite script that looks at the order and based on whatever it add line items?
any advice from someone who has done it before would be great?

You can use User-Event/Workflow or Map-Reduce/Scheduled/Mass-Update scripts which will filter orders, and update orders.

Related

Shopify changing product price for variation by app

I am a shopify partner, I am trying to get around the the variant limits of shopify by coding an app and also because my client has a complicated formula for calculating the price. I don't have a problem with the part that adds the information for my variants to the order, however when I want to modify the price based on the user selection, it doesn't seem an easy task to do.
I came across couple of apps which does the same thing by adding a new product or variation which is not optimal for my use case, is there any app that does the job without adding extra information to the database, if so, how?
Qualified Yes
Unfortunately, Shopify doesn't give us a lot of options to edit prices of items dynamically. Here are the two options that I know of that will allow you to adjust the price of a product directly - however, both have limitations.
Using Shopify Script Editor
If you're working with a Shopify Plus merchant, you can use the Shopify Script Editor to dynamically adjust the prices of products, provided that the direction you adjust is down. You cannot increase the price of a product using the script editor - so for your use case, the list price would have to be the most expensive possible price that the item sells for, which you would then discount appropriately using the app.
Using draft orders
Using an app, you can use Shopify's Draft Order API to create an order with custom discounts and/or create completely custom items that are independent of the products set up in the product database.
The basic flow for this is that when the customer clicks 'checkout' you halt the normal navigation, send the cart contents to your app, create a draft order with the appropriate pricing, then supply the front-end code with the draft-order checkout/invoice URL so that you can send the customer there instead of the normal checkout. This has several limitations, however, including that prices of existing products can only be discounted, not increased, and the fact that Shopify will not allow a customer to use discount codes on a draft order invoice - once an order is set up this way, Shopify's assumption is that all prices are final.
Disclaimer: Sorry if someone sensible doesn't like a response with a link :) I'm not related to this app I'm just a user.
On a project with complex pricing, we use the app Wholesale Pricing Discount by Wholesale Helper we liked because is easy to import multiple pricing by-product and relate it by customer.
this app does not multiply the products, they use customer tags. maybe that can give you some guidance.
An important rule on Shopify is you can't increase the price by API on an order, you can just reduce i

How to effectively manage inventory with BigCommerce API

I have am trying to make a tool to manage inventory levels between my warehouse system and my bigcommerce store. The issue I am running into is the Bigcommerce only sets inventory levels based on the Ids/Variant Ids. My warehouse software only knows products by sku/subsku.
The first step in the process is getting the ids and variant ids and storing them for current use and later usage.
I do this by calling "catalog/products" and getting all the products for the catalog through a series of calls to build a complete list. I loop through and then do the same for the variants "catalog/products/{0}/variants"
With this list I match my skus and variants to the catalog list returned. Update the matching skus to big commerce id/variant ids for future and then finally I begin the process of actually updating inventory levels.
I then begin updating the product by calling the endpoint "catalog/products/{id}"
or
"catalog/products/{id}/variants/{variantId}"
This process takes way too long even for a few quantity level updates. Is there a better way?
I have also noticed that sometimes the big commerce ids will change for some skus. Which require a complete resync.
Are there better endpoints to use? Is there a way to update an item based on the sku not the id/variantid?
My solution is in C# but code is not the problem. The problem is what to call and if there is a better way to call the endpoints.
One area I see an opportunity to streamline the API calls is here:
I do this by calling "catalog/products" and getting all the products
for the catalog through a series of calls to build a complete list. I
loop through and then do the same for the variants
"catalog/products/{0}/variants"
You can get products along with their variants by including variants as a subresource using the ?include= param. For example:
catalog/products?include=variants
There would still need to be some kind of mapping from variantID to SKU, but when it comes to pushing the updated inventory to BigCommerce, we're also close to releasing updates that will allow you to batch update up to 50 products or variants in a single call. Keep an eye on our Changelog for that announcement: https://developer.bigcommerce.com/changelog

API for auto discount based on customer group Shoopify Plus

Hi we have a shopify plus store and we have to provide a auto discount based on the customer groipus.
Suppose a customr is in vip group he should get automatically 50 % discount.
I can see shopify don't provide this.
Can you please provide an API reference with which i can detect the customer group and apply discount on his cart.
Check out the Shopify Script Generator here https://jgodson.github.io/shopify-script-creator/
I use this for creating all our scripts and it makes it so much easier.
I currently have a script which automatically applies free delivery to all customers with a "VIP Platinum" tag from our loyalty program, you can do the same thing for discounts.
tip, don't forget to export and save the file somewhere, this way if you need to edit or add another rule to it you don't need to start from scratch again.
edit: forgot to mention, as per your requirement this doesn't apply a discount code either. you can use the generator to create another script to block discounts from being used with this if you need/want

How do I access Shopify data without advanced account?

All I'm wanting to do is track sales of certain products from a certain date. My company is wanting to add a banner to track sales goals for raising money for charities. So basically, we'd tag a few products as being part of that goal, set a goal, and then need to update the goal progress by a certain amount every time a sale is made on one of those products. As far as I can tell, without access to Shopify's analytics API, this is not possible. How can I do this?
What you want to build is perfectly possible. However, you need to generate Private App Credentials, so you can use Shopify API. It doesn't matter if you have an account by yourself, someone else can follow these steps and send you the credentials your way.
If you don't actually need to modify anything through the API, you could have them set a webhook (Settings -> Notifications -> Webhook) on Order Creation (or similar) that posts to your server and you can check what product got sold and see if it has got the tag.
The "easy" way to do this is to create an app that receives order webhooks and can check on tagged products and keep a sum of target items sold.
Then the app should have use a script tag to insert a simple script with the current value into the web page at a configured place by css selector
OR the app could update one or more snippet files that you could include until the promo is done.
I'd tend to go with the script tag option since that's a bit more flexible and you should be able to change your theme when the promo is over to report results without having to touch the app again.

POST Order with values for configurable product fields?

I've successfully got 3rd party merchant orders posting new orders to my client's BigCommerce store programmatically. I've even got product options posting as part of the order (product->option set-> option relationships are a total cluster).
My client relies heavily on configurable fields. I'm able to pull the definitions of the configurable fields for each product, but can't find a way to POST or update the configurable field values through the API.
Is it possible to manipulate an order's configurable fields through the API?
Got a response from the support team # BigCommerce. Manipulating configurable fields via the API is not currently possible and not currently on the roadmap.
Original reply below:
Unfortunately that is a product limitation with the API, it will not tie to configurable fields on the product. The best you can do is attach that information through a generic text field like 'staff_notes'. Honestly I have not heard of any talk of adding a way to add products with configurable fields to orders via the API. I think this may be because anything that can be done with configurable fields can be done with options and options are what is being pushed for the future. I have noted this feedback down though and will pass it along to our Product Manager for the API. Best case scenario is that it may be seen in a future version of the API which is at least several months away.