Update product URL with API

Tourist
16 0 1

Hi,

Is there a way to update the SEO URL with the API? either when creating a product or afterwards, don't really mind. 

I just don't want to do it manually, I want the URL to be something like /products/title+handle.

Thanks. 

0 Likes
Explorer
83 0 23

Hi Isaacdvory,

I assume you're asking about updating or creating the handle?

As noted in the documentation you can use the handle property to modify or create it, the code below is for when a new product is created (language: Ruby)

    i = ShopifyAPI::Product.new({
        :product=> {
            :handle=> "this-is-my-new-product-handle"
            #rest of product information...
    })
    i.save

 

0 Likes
Highlighted
Tourist
16 0 1

No exactly, when editing a product, at the end of the page there is a field called  "URL and handle" under "Search engine listing preview" , so from that , I'm assuming URL and handle are not the same thing. 

Unless you're telling me that by changing that field, the handle will change as well , which will seem strange as the Handle is my product SKU and I would rather it stays as it is now... 

0 Likes
Explorer
83 0 23

Hi Isaacdvory,

That is exactly what it changes, the url is "https://mystore.myshopify.com/products/" and your handle is the part you are able to change hence in the code above ("this-is-my-new-product-handle") would produce: https://mystore.myshopify.com/products/this-is-my-new-product-handle

 

 

0 Likes
Shopify Partner
104 6 19

You don't need to use the API for this if you don't want to. This is something our automation app, Mr. Arigato can do for you with plenty of flexibility to get it just right. Check out https://www.apps.bonify.io/mr-arigato-task-automator-for-shopify/workflows/change-seo-page-titles-se... for more info.

 

seo.png

0 Likes