Accessing "Company" from Input.cart.shipping_address

rossbrown
Shopify Partner
3 0 3

Is the "company" attribute accessible from Input.cart.shipping_address? Input.cart.shipping_address.company returns a no method error. This seems like something that should be accessible from the Shipping Address object, especially since it so closely resembles its Liquid counterpart which provides access to it.

 

My use case is to show specific business shipping options when shipping to a business, which is inferred by the entry of a company name. Any insight into accessing the company field would be helpful, otherwise consider this post a feature request 🙂

Replies 2 (2)

Carsten_A
Shopify Partner
16 2 6

I'm looking for the same feature here: https://community.shopify.com/c/Technical-Q-A/Access-quot-Company-quot-field-or-a-custom-field-in-Sh...

Did you find anything yet?

Otherwise, if it's usable to you; you can activate Address Line 2, change it's labels to something company related and then access this field in Shopify scripts. Then you could toggle the shipping methods based on the input of this field. 

rossbrown
Shopify Partner
3 0 3

I received a response from Shopify support saying they do not support accessing the company field from Shopify Scripts. I had to implement a front-end solution for my feature by initiating a change handler on "input#shipping_company_value", binding it on the "page:load" and "page:change" document events.

Clever solution with the Address 2 field 🙂