Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all 25503 articles
Browse latest View live

Alex Richter commented on DiscountCode.find() error in python API

$
0
0

Hey Seth,

You have to access discount codes through price rules using a prefix option. Your Python should look like:

shopify.DiscountCode.find(price_rule_id=3419440789)

Or if you're looking for a single discount code: 

product = shopify.DiscountCode.find(30965301271, price_rule_id=3419440789)

Cheers. 


flashError and flashNotice look strange. by Andy Sly

$
0
0

I'm developing an embedded app and up until now have had no issues using ShopifyApp.flashError() and ShopifyApp.flashNotice() with expected results.

However, within the past few hours, they have suddenly started looking stange--they are pushing up the iframe that contains my embedded app instead of overlapping it across the bottom, and the alert itself is now flush bottom with the browser window. This happens in all development stores I've tested the app in.

Since as far as I know the flash notices are displayed in the parent window, this shouldn't be an issue with any CSS styles or markup I've added. Any idea what the cause may be?

I've attached a screenshot with an example of what I mean. I set the background of my app to dark gray so you can see where it cuts off when the flash messages pop up at the bottom.

Report an order as refunded which was payed through a 3rd party gateway by Axel Persoon

$
0
0

Hi,

We're creating a private app in order to process refunds for orders payed through a 3rd party payment gateway (Mollie). I'm aware that we won't be able to actually process the refund through Shopify, we're placing a direct API call on Mollie's API for that.

However, according to this article (https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/refunds-and-refunds-calculator-api-392176) it is possible to create a refund through the Refund API with an empty transactions array, in order to let the refund show up in reports and analytics.

When attempting this we receive the following JSON object as callback:

{ id: 15026356285,
order_id: 371519291453,
created_at: '2018-03-08T21:55:32+01:00',
note: '',
user_id: null,
processed_at: '2018-03-08T21:55:32+01:00',
restock: false,
refund_line_items:
[ { id: 21269872701,
quantity: 1,
line_item_id: 815696052285,
location_id: null,
subtotal: 16.5,
total_tax: 0.93,
line_item: [Object] } ],
transactions: [],
order_adjustments:
[ { id: 8335130685,
order_id: 371519291453,
refund_id: 15026356285,
amount: '16.50',
tax_amount: '0.00',
kind: 'refund_discrepancy',
reason: 'Refund discrepancy' } ] }

The 'refund_discrepancy' kind seems to say that the refund is wrong in some way and can't be done. I can't find any documentation on this status though, so now I'm not sure what's wrong and if it's possible at all to report (not process) a refund on an order through the Refund API. Hope you guys can give some clarification!

skuby Admin commented on App only works on the computer it's installed on..?

$
0
0

Additionally, it seems to break if installed in more than one store at a time - not good!

ngrok logs show '/auth/shopify/callback' returning '302 Found' if installed in one store, '406 Not Acceptable' if installed in more than one.

Order payment webhook fails to fire with bogus payment gw? by run-the-edge-dev Admin

$
0
0

Hello,

I'm in the process of prototyping a quick Hubspot integration via a Spotify webhook call on order payment in my dev store (run-the-edge-dev.myshopify.com)

The webhook was created via admin interface (not API). The website which receives webhook from Shopify is up & working. The webhook triggered via "Send Test Notification" in Notifications section of Admin is correctly triggered and is correctly received on my website.

However, when I create a fake successful transaction with bogus payment gw (CC of 1, CCV of 111), the webhook never materializes. It used to work a couple of days ago, but now it does not. 

I tried deleting and re-adding webhook without success.

Status page for Spotify shows all subsystems a-ok.

What can be going wrong? Is there a error counter which disables webhooks on Shopify side?

 

Thank you,

Pawel

Shipping Rates and Pre-Orders by CRGGR

$
0
0

Hello all, I am part of a developer team, working with a Shopify Plus merchant. Right now we are dealing with generating our own custom carrier and returning our rates and such for shipping. That being said, we are now at a point where we are looking to handle pre-orders. Pre-orders for this merchant are already an odds and end terrority of its own. 

Our thoughts so far go about this far:

  1. Customer adds a pre-order item to their cart.
  2. They go to check out, and a pre-order item is in their cart.
  3. We want to be able to return a shipping rate (which we have figured out on our own carrier service end)
  4. Being a pre-order, which -can- change, we want to return an empty date, or super vague idea.

Now on the Shopify Carrier Service API, it seems a date has to be sent back, or else the shipping rate isn't displayed?

Going further with this, it may just work better to give pre-orders their own special flow using a custom liquid template and keeping them out of the cart with non-pre order items. We don't quite know.

We do store the ideal pre-order date the item should be released. The idea would then be to get that pre-order release date, and just base the min/max deliver date to be the difference from then and now. However, the release date of pre-order items may change, and we want customers to understand the expected shipping date is not guaranteed. 

I'm sure we can do that just through some text on a page, but we want to be as thorough as possible.

skuby Admin commented on App only works on the computer it's installed on..?

$
0
0

This looks to be a bug I introduced when trying to write my recurring_application_charge method. If I take that out, push to heroku, and install in multiple stores it works again.

Roger McEffort commented on Search API

$
0
0

Ok, thanks. I don't see the Search API anywhere... are you telling me it doesn't exist through the Admin API?


Embedded SDK and ngrok giving 502 error by Zach

$
0
0

Hi,

I am simply trying to get a "Hello World!" Shopify app up and am running into a problem.  I am using Python's Flask, deploying it to my localhost:5000, and using ngrok to push it live to the web.  The ngrok configuration looks successful, but the embedded app (after installing it to my dev store) gives a "502 Bad Gateway  /  The server returned an invalid or incomplete response" error.

All of my code is visible at https://github.com/aristocratious/purple-starfish

If anyone has any ideas of what to even Google to help me fix this or know the solution, I would be very grateful. 

Thanks,
Zach

Seth H. commented on DiscountCode.find() error in python API

$
0
0

Thanks, that did indeed take of it. Much appreciated!
I guess that explains the "_prefix_source" variable... Out of curiosity, do you know if this is documented somewhere other than the code?

get product by price using fetchQuery by Abhilash

$
0
0
const query = {
            query: 'variants.price:="82.00"',
            sortBy: 'title'
        };
        client.product.fetchQuery(query).then((productss) => {
            console.log(products); 
        })
 

Is it possible to fetch a product by targeting a field inside variants array? Example: Show me products having variants.price = 82.00?

How to use OAuth to place an order by eddyparkinson

$
0
0

I want to place an order via the API. But would rather use OAuth2.

How to convert the code below to OAuth style? The code is based on:

 

Example with Username + password   - Shows how to use Username + password to post add a new product.

https://help.shopify.com/api/tutorials/using-postman

 

Example with OAuth2 - only shows web hooks - no details of how to place an order

https://help.shopify.com/api/tutorials/building-node-app

 

Code - with Username + password

const dotenv = require('dotenv').config();
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const crypto = require('crypto');
const cookie = require('cookie');
const nonce = require('nonce')();
const querystring = require('querystring');
const request = require('request-promise');


....



   const placeOrderRequestUrl = 'https://' + shop + '/admin/orders.json';
   const placeOrderPayload = {
     "order": {
       "line_items": [
       { "quantity": 1,
         "variant_id": 606602985481,
         "title": "EMILY SINGLET DRESS ",
         "price": "7.75",
         "product_id": 60511617033,
         "gift_card": false }
       ]
     },
   };

   request.post(placeOrderRequestUrl , {  json: placeOrderPayload })
   .auth(apiUser , apiPassword, false)
   .then(function (response) {
        console.log("placeOrder succeeded with status %d", response.statusCode);
     })
     .catch((error) => {
       console.log("placeOrder failed");       
       console.log(error);
     });

How to convert this to OAuth style?

 

Abhilash commented on get product by price using fetchQuery

$
0
0

I kind of got the solution. It still doesn't solve my exact use case, however, it's close.

    const query = {
        query: "variant:['price: 82.00']"
    };
    client.product.fetchQuery(query).then((products) => {
        console.log(products); 

    })

Now, what basically happened here is that I received the `product` that had a variant whose price was `82.00`. What I was looking for is to only get the `variant` that had the price of `82.00` along with the product.
This is because may be the `variant` isn't mapped as a field type = nested.

Shopify internally uses elasticsearch. Hence, the mechanism is similar.

Querying all variants updated since date? by Clement

$
0
0

Is it possible to query for variants updated since a particular date?

(without querying all products of course)

As far as I can tell it is possible for the variant's updated_at to be later than its parent product's updated_at.

Why do we need InventoryItem (multi-location)? by Clement

$
0
0

Looking at the multi-location items, why was the decision made to introduce the InventoryItem resource?

If there is a one-to-one relationship with ProductVariant, why not simply links the InventoryLevel directly to variants?

Hoping someone can shed some light here, maybe I'm missing something.

https://help.shopify.com/api/reference/inventoryitem


All customer name displayed same for all order by Nir Giftagram

$
0
0

Hello Support,

I have integrated Shopify web service in our portal. I am placing an order from web service to Shopify admin. I am following this service https://help.shopify.com/api/reference/order#create

When I set deffrent email address for all orders it was working fine
But now i am passing same email address for all customer (for all orders)

Following are my request for that.

$ch = curl_init("https://".$api_key.":".$api_pass."@".$api_url."/orders.json");

        $cntry = $orderList->cname;
        $order = array('order' => array(
            'line_items' => array(
                array(
                    'title' => $orderList->gname,
                    // 'price' => $orderList->giftamt,
                    'price' => 0,
                    'quantity' => 1,
                    'properties' => array(
                        array(
                            "name" => "ORDER ID",
                            "value" => $orderList->id
                        )
                    )
                )
            ),
            'customer' => array(
                'first_name' => $orderList->firstname,
                'last_name' => $orderList->lastname,
                'email' => 'partners@giftagram.com'
            ),
            'billing_address' => array (
                'first_name' => $orderList->name,
                'last_name' => $orderList->name,
                'address1' => $orderList->address1,
                'address2' => $orderList->address2,
                'phone' => $orderList->phone,
                'city' => $orderList->city,
                'province' => $orderList->provience,
                'country' => $cntry,
                'name'=> $orderList->name,
                'zip' => $orderList->postal,
                'default' => true
            ),
            'shipping_address' => array (
                'name' => $orderList->name,
                'first_name' => $orderList->name,
                'last_name' => $orderList->name,
                'address1' => $orderList->address1,
                'address2' => $orderList->address2,
                'phone' => $orderList->phone,
                'city' => $orderList->city,
                'province' => $orderList->provience,
                'country' => $cntry,
                'zip' => $orderList->postal,
                'default' => true
            ),
            // 'transactions' => array(
            //     array(
            //         'status' => 'success',
            //         'amount' => $orderList->giftamt+$orderList->taxamt
            //     )
            // ),
            // 'total_tax' => $orderList->taxamt,
            'total_tax' => 0,
            'currency' => $orderList->currency,
            'note' => "To: ".$orderList->receiver_name." sent via Giftagram

Message:
".$orderList->description."

From: ".$orderList->firstname." ".$orderList->lastname."
hello@giftagram.com",
            'shipping_lines' => array(
                array (
                    "code" => "Shipping",
                    "price" => $orderList->shipamt,
                    "title" => "Shipping"
                )
            )
        ));

Bharath commented on Orders/Paid webhook didn't get triggered in case of initial payment failure.

$
0
0

Hello Shopify Team, 

Any update on this?

Jason commented on All customer name displayed same for all order

$
0
0

What's the question you're wanting to ask. I don't see one.

Nir Giftagram commented on All customer name displayed same for all order

$
0
0

I want to pass same email for all customer for all order 

You check above code

 

But after create order using API all name customer name getting same in Shopify admin

Update inventory using the admin/inventory_levels/set.json endpoint by Ram

$
0
0

Hi,

I have setup a private app which i used to update stockbalances of products via api. Updating the stockbalance using /admin/variant/{variant_id}.json  using by sending PUT http request with following body is does not update the inventory anymore probably because of the deprecation of inventory_quantity. 

 

{
"variant":
{
"id":123456,
"inventory_quantity":83
}
}

PUT /admin/variant/{variant_id}.json 

Now i moved to using POST inventory_levels/set.json with the following body and it gives unauthorized response... Inventory permission and write and eveything else has read and write permission for this private app yet i can not update the data ... request body is as below

{
    "location_id": one of the location id obtained from GET locations.json,
  "inventory_item_id": inventory_item_id from GET product ,
  "available": 42
}

Any idea how to solve this or why is it happening ? Content-Type header is application/json and Accept application/json in both case.

Viewing all 25503 articles
Browse latest View live




Latest Images