Creating a product that requires no fulfillment or Altering fulfillment_status on open order

jfoster
Shopify Partner
4 0 4

Our app creates a product that does not need to be fulfilled by the shop keeper. Currently, they still must click fulfill the product (leaving shipping info blank) to clear out their order. This annoys them.

 

I'm seeking to either:

1. Create a product that automatically does not need to be fulfilled once ordered OR

2. Automatically fulfill this product when it appears in an order.

 

I looked at using the python library to first get the product from the order and set the fulfillment_status attribute but I am getting a 406 ClientError with msg="Not Acceptable" back.

A. Is it possible to create products in shops that don't require the shop owner to "fulfill" them when handling the other items in the order?

B. If not, what is the appropriate way to programmatically alter an order's line_item's attribute, fullfillment_status?

C. Is there some other way to properly set fulfillment on a product automatically?

 

Here are the python calls I'm using to get to the error:

my_order = order.find('ORDER_NUM')
my_order.attributes['line_items'][0].attributes['fulfillment_status']
>> returns None / null
my_order.attributes['line_items'][0].attributes['fulfillment_status'] = 'fulfilled'
attrib['line_items'][0].save()
>> causes ClientError

Here's the ClientError in full:

ClientError: Response(code = 406, body = "", headers = {
'x-shopify-stage': 'canary',
'x-shopify-shop-api-call-limit': '1/40',
'x-shopid': 'SHOP_ID',
'http_x_shopify_shop_api_call_limit': '1/40',
'x-request-id': 'ecfae2a8-305f-4672-9210-874522f8e53c',
'x-xss-protection': '1; mode=block; report=/xss-report?source%5Baction%5D=error_404&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ferrors&source%5Bsection%5D=admin_api&source%5Buuid%5D=ecfae2a8-305f-4672-9210-874522f8e53c',
'x-content-type-options': 'nosniff',
'x-stats-apiclientid': '2879899',
'x-shardid': '83',
'transfer-encoding': 'chunked',
'referrer-policy': 'origin-when-cross-origin',
'x-sorting-hat-shopid': 'SHOP_ID',
'x-download-options': 'noopen',
'x-stats-apipermissionid': '',
'x-shopify-api-terms': 'By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms',
'x-shopify-api-version': '2019-04',
'date': 'Fri, 26 Apr 2019 21:17:24 GMT',
'x-stats-userid': '',
'content-security-policy': "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://dme0ih8comzn4.cloudfront.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=error_404&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ferrors&source%5Bsection%5D=admin_api&source%5Buuid%5D=ecfae2a8-305f-4672-9210-874522f8e53c",
'x-dc': 'chi2,gcp-us-central1',
'strict-transport-security': 'max-age=7889238',
'x-sorting-hat-podid': '83',
'server': 'nginx',
'connection': 'close',
'x-permitted-cross-domain-policies': 'none',
'x-frame-options': 'DENY',
'content-type': 'application/json'
}, msg = "Not Acceptable")

 

Replies 3 (3)

Zameer
Shopify Staff
297 31 90

Hey there,

 

It looks like you're trying to update the orders line items using the Orders API, but instead, you should be using the Fulfillments API.

 

When you create a new fulfillment for the order, the line items fulfillment_status will automatically get updated to the correct associated status.

 

Creating a fulfillment will also require you to pass in the location where the fulfillment is being made, this guide explains that process.

 

There's also a setting titled "This is a physical product", which it sounds like you can disable which would remove the need for shipping information.

 

So although this can't be done automatically, by subscribing to the appropriate webhooks like orders/paid, you should be able to accomplish this with a few API calls.

To learn more visit the Shopify Help Center or the Community Blog.

jfoster
Shopify Partner
4 0 4

Thank you, Zameer

 

I will give this a shot.

Boneoh
Tourist
10 0 3

I'm trying to do the same thing. Did you have any success with your processing? Thanks in advance.