Error when using Product.type method?

Highlighted
Shopify Partner
5 0 0

Hi All.  The docs ( https://docs.shopify.com/api/tutorials/shopify-scripts ) say that the Product object has a "type" method to get the product type, but when I try to use it, the console outputs "[Error] undefined method 'type' for #\<Product:0x7f21457ff570\>". What gives? All of the other product methods work.  If I take my exact code, and just change ".type" to ".id", ".vendor", ".tags", etc, there is no error.  Has the type method been removed?

0 Likes
Highlighted
Shopify Expert
4175 29 400

Have you tried product_type ?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
2 Likes
Highlighted
Shopify Partner
5 0 0

I had not tried that, but it worked.  Thanks!  I'd respectfully request to the maintainers of the docs to update the method name from type to product_type :)

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1 0 0

Hi Rick,

I've updated the method name in the documentation. Thanks for pointing this out!

0 Likes