Shopify API CARTS - Changing line_item line_price for price Override - api

Shopify has a CARTS api but it is read-only. I am trying to find a way to manipulate the line_item's line_price or price attribute. Shopify support has directed me here for an answer.
Since there is no proper documentation on this any help would be appreciated.

Products have variants, and a line item has a product ID and a variant ID. A line item has a price too. And no matter how you access that item (using the Ajax API or the backend API) you cannot manipulate the price. If you want to change a price, you have to change the product's variants price. That you do with the backend API and the product or variant calls.

You can't directly manipulate the price of a line item in a cart. As you mentioned, the Carts API is read-only. That's all there is to it.

Yes you can!
Dont mess the people, you can do everything you want with your store.
You can do it via JavaScript, this is some related code i have used:
//update price when changing quantity
function updatePricing() {
jQuery('#quantity').val(jQuery('#choose-select-value option:selected').val());
var quantity = jQuery('#choose-select-value').val();
var unitPriceTotal = jQuery('.product .total-price').text();
var totalPrice = unitPriceTotal * quantity;
jQuery('.product .price').html().replace(regInput ,totalPrice);
}
This is just a way to help you go to the right place...
But please, people dont mess if you dont know something, its your store and you can do anything....
I hope this helps to you to find the way.

Related

when you add a BigCommerce product to Wishlist, the SKU is not added to {{wishlist.item}} object

When you add BigCommerce product to Wishlist, the SKU is not added to {{wishlist.item}} object.
I did a {{log wishlist}}, after the product is added, the SKU is null.
the item object has a lot of key fields that are null like availability, summary, stock_level and also boolean values like pre-order, has_options etc. How can i populate them when adding a product to wishlist?
Is there a way to pass the SKU thru "/wishlist.php?action=addWIshlist&product_id={{product.id}} ??
if possible, how and where can i use JS code to pass this value to the wishlist action everytime i add a product to wishlist?
According to BC's Wishlist Object documentation, you should have access to the product's SKU. Now, if you have SKUs set at the variant level, and are trying to access that, you will be out of luck. Products only get added to the wishlist at the product level, and do not contain any variant information.
The issue you might be having is you might be trying to access this data on a page where it is not exposed. The only page where this data is exposed is on the wishlist details page for that wishlist. To access it on another page, you would need to make an AJAX request to the wishlist details page.

ebay finding api finditemsbykeywords pagination problem

I tried the following calls:
https://svcs.ebay.com/services/search/FindingService/v1?X-EBAY-SOA-OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.13.0&keywords=waschbecken&RESPONSE-DATA-FORMAT=JSON&GLOBAL-ID=EBAY-DE&outputSelector(0)=ItemSpecifics&paginationInput.entriesPerPage=100&paginationInput.pageNumber=2
then on the ebay API explorer for the post request body,
<findItemsByKeywordsRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<keywords>waschbecken</keywords>
<paginationInput>
<entriesPerPage>100</entriesPerPage>
<pageNumber>2</pageNumber>
</paginationInput>
</findItemsByKeywordsRequest>
but I do not get 100 searchResult count per page, in Postman I get 32 searchResult and in API explorer 56; furthermore 2nd page forward I do not get any searchResult count, I am trying to understand is there something wrong that I am writing in the call or there is some another problem or any parameter I am missing.
Thanks for the help.
I am also running into this problem. I am guessing that the pagination results are for the entire store, but not for the search by keywords....Seems like they dropped the ball on this.
Sorry, I did not update on the question, I forgot about it.
The problem was not with the pagination, the problem is the variants.
Simply explained, the output of the query doesn't count for the variants listed on the Ebay search by the same seller. If you have from a same seller the same product with the different variant, the query does not show the variants from those product from the same seller just different variant, as it would if you do an ebay search.
The mechanism of the query is different as that of the product search on Ebay.

Can you change the shortID from SKU to variant ID? (Shopify integration)

i'm writing on behalf of our client MOEBE.
Our developer has a problem with the way Roomle use the shortID which is used to add the items into the cart. He says that we need to change the shortID from SKU to product variant ID. Shopify doesn’t allow the cart API to use SKU to add items in the basket.
Alternative if we can get access to the backend in Roomle, then he will be able to create a map between the SKU and variant ID.
Sadly shopify do not allow using SKU codes using Ajax API.
If you modify the process of adding to the cart You probably need use some try and error run.
The very fact of adding a product to the cart can be largely solved by extending the JS code on the product page.
I suggest listing the variants of the product to the variable in the liquid template and using an additional script to handle adding to the cart. It might look dirty, but it will work.
<script type="text/javascript">
var product= `{{ product | json }}`; //Whole product variable
var variant_id = {{ product.variants[0].id }}; //First product variant id
</script>
Do you have one variant per product or more?

Shopify Scripts - New Line Item

I would like to add a new product (line item) via Shopify Scripts when a user uses a discount code. Is it possible?
if Input.cart.discount_code && Input.cart.discount_code.code == "first10"
Input.cart.line_items << LineItem.new(variant: 24665166184512, quantity: 10, source_indices:false,grams: 0, properties_was:false, properties:false, line_price_was:false, line_price:50, original_line_price:50, discounts:0, adjustments:nil)
end
Output.cart = Input.cart
And I have error:
[Error] undefined method 'id' for 24665166184512
shopify/std_lib_mutable/core/resources/line_item.rb:164:in LineItem.to_hash
shopify/std_lib_mutable/core/resources/cart.rb:43:in Cart.to_hash
shopify/std_lib_mutable/cart_line_items/output.rb:4:in #<Class:0x7f85471e6280>.to_hash
shopify/std_lib_mutable/cart_line_items/output.rb:4:in #<Class:0x7f85471e6280>.to_hash
shopify/std_lib_mutable/core/script_kernel.rb:12:in Object.prepare_output
(prepare_output):1
Unfortunately you cannot add products to a cart using Shopify Cart Scripts.
Cart scripts can only see and handle items that are already present in the cart.
as mentioned in comments, you can delete an item because it already exists in the cart.
My advise is to use either of these methods.
1) discount codes that when someone buys something they get another product at a certain price or free.
2) create an Ajax API script that when an item is added to the cart it looks up what items are in the cart and if the item is found then adds the free item or discounted item to the cart.
https://help.shopify.com/en/themes/development/getting-started/using-ajax-api
3) (PAID OPTION) is to have a look in the app market place and you can find a few different apps available to help you with this. this one looks like it might help you? https://apps.shopify.com/special-offers

eBay API change currency of returned price

Is there a way to get an item in another currency using the eBay API?
Very simple. All you have to do is change the site ID parameter. Since you didn't specify a language, I'm going to assume you're doing this HTTP-GET and just parsing the XML. The same principles will apply regardless of how you do it, programatically or not.
For a URL:
"http://open.api.ebay.com/shopping"
?callname=GetSingleItem
&responseencoding=XML
&appid=[APPID]
&siteid=2 <------------This, for example, is Canada's siteid. 0 is US. This will change the currency returned under < ConvertedCurrentPrice>
&version=839
&ItemID=181195344321
Put it all together and you get this copy/paste-friendly "http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=[APPID]&siteid=2&version=839&ItemID=181195344321"
Make sure to use your app ID as the parameter.
You can use this call for currency change:
Currency type can be changed in Ebay while listing an item using Add Item call in Ebay's trading API.
http://developer.ebay.com/devzone/xml/docs/Reference/eBay/extra/additms.rqst.additmrqstcntnr.itm.crrncy.html
Thanks CedCommerce
You can and it's actually very simple. You can use the Shopping API GetSingleItem.
Depending on what currency you are interested in, all you have to do is change the SiteID on which you are making the call. For example, if you want to get the price in EUR, you can set the SiteID to 3(UK), or 77(Germany). You will also have to set the IncludeSelector to "Details". This way, you will get a response that will contain the following fields.
<ConvertedCurrentPrice currencyID="GBP">68.55</ConvertedCurrentPrice>
<CurrentPrice currencyID="USD">92.9</CurrentPrice>
where the CurrentPrice is the original price of the listing, on the ebay site the listing was made, and the ConvertedCurrentPrice is the price of the listing on the site that corresponds to the SiteID you supplied.
You can see a full list of SiteIDs with the currencies they are using here